## WeBWorK Main Forum

### minimum tolerance

by Zak Zarychta -
Number of replies: 2
What is the minimum tolerance that $WW will accept? Is there any way to make this smaller. I've tried Context()->flags->set( tolerance=>1e-40, tolType=>"absolute" );  to no avail Anything smaller than 1e-19 yields is interpreted as zero. Although$WW accepts quite large values such as 1e77.

I'm writing some questions on indices that takes random numbers clearly with certain combinations of y and z the value of (x^y)/(x^z) can be pretty small

Zak

### Re: minimum tolerance

by Arnold Pizer -
Hi Zak,

Assuming you are using MathObjects check out zeroLevel and zeroLevelTol in http://webwork.maa.org/wiki/Context_flags

Using MathObjects  is the best way to do do things, but zeroLevel and zeroLevelTol has been part of WeBWorK from day one but probably there are very few examples of problems that do not use the defaults.

Arnie

### Re: minimum tolerance

by D. Brian Walton -
This may not be a problem with WeBWorK, but an issue with how computers store numbers and where WW is checking your formula. I assume you know that computers only keep a certain number of binary digits. Consequently, there are gaps between numbers for which a computer has no representation. See http://en.wikipedia.org/wiki/Machine_epsilon

This would suggest 1e-16 is the gap when numbers compared are close to 1, so 1e-19 is the gap between 0.001 and the next closest representable number.

I would recommend using relative tolerance and then specify that the test points used in comparing the function stays in a range where the resulting formula does not grow too large.

I have had similar issues involving exponential functions e^{kx} where I needed to set the interval for the test points to adapt with the particular rate of the exponential function so that it would work correctly for a variety of different values of k, for example using an interval [-1/k,1/k].

In your case you might want to avoid an interval where numbers are too small.

D. Brian Walton