fn = function(x) x^6
o = optim( par=15, fn,lower=-20,upper=20,method='L-BFGS-B')
o.s = optim.stop( par=15, fn,lower=-20,upper=20,method='L-BFGS-B',fn.stop=0.1)
#check o.s$value == 0.1 && o.s$counts < o$counts
Run the code above in your browser using DataLab