WeBWorK Main Forum

Setting zeroLevel to allow small numbers seems to have no effect.

Re: Setting zeroLevel to allow small numbers seems to have no effect.

by Davide Cervone -
Number of replies: 0
Arnie:

You are correct about the tolerance (but I was responding to the original post, not yours, so wanted to point out the problem with the relative error). In any case, the tolerance value doesn't affect the preview display problem.

For the display, MathObjects asks the question "Is the correct answer zero?" (in order to avoid printing things like 3.276E-16 for an answer that should be zero). This means that the correct answer is being compared to zero, and in a comparison, when one of the two values is within the zeroLevel of zero (which in this case it is, since one IS zero), absolute error is used with the zeroLevelTol. So, yes, zeroLevelTol is what controls the display, and that is hard coded.

On the other hand, when the student answer is checked against the correct one, neither of which is zero, the zeroLevelTol is only used when one is within zeroLevel of zero. In the case described by the OP, since zeroLevel is smaller than the student and correct answers, the zeroLevelTol doesn't come into play, and the answer is graded correctly (but displayed as zero).

I suspect it is best to set both when you set one of them, so that they remain relatively synchronized. The defaults are not equal, and I'm not sure exactly why zeroLevelTol is larger than zeroLevel, but that is how it was historically, so that is what is done in MathObjects. The fact that zeroLevelTol is larger than zeroLevel does mean that you can get this strange behavior (displayed as zero, but checked as non-zero).

Davide