WeBWorK Problems

small number woes

Re: small number woes

by Davide Cervone -
Number of replies: 0
Some history is needed to understand this. The MathObjects library was not in the original versions of WeBWorK, and the answer checkers that were available at the time where the ones like num_cmp() that you reference above. Each answer checker worked in isolation, and there was no Context() command. In 2004, the first version of MathObjects was developed, and that is the library that included Context(), and the various ->cmp() methods. Eventually, the traditional answer checkers like num_cmp() were rewritten to use MathObjects internally, but (in order to remain compatible with the original versions), they don't use the active Context(), but instead use their own internal contexts. So the changes you make to the MathObejct context doesn't affect num_cmp(), as you have seen.

The values that are stored in the Context() for MathObject traditionally were stored as plain variables, so if you set

$zeroLevel = 1E-36;
$zeroLevelTol = 1E-38;

instead of the Context() command, then the num_cmp() call should use those.