## WeBWorK Main Forum

### relative tolerance cmp vs num_cmp

by Joel Trussell -
Number of replies: 1
is it intentional that using relative tolerance in cmp and num_cmp are different. If I use
ANS(\$aFv->cmp( tolerance => 0.01,
tolType => "relative",
));
http://webwork.maa.org/wiki/NumericalTolerance#.WNVpk2e1thE

if I use
tolType => "relative",
));
Yes, this is intentional. The legacy answer checkers like num_cmp used relative tolerance as a percentage value, while absolute tolerance was not. This was confusing, so MathObjects used non-percentage values for both. That way, a tolerance of .01 means roughly 2 significant figures, whereas .01 in num_cmp would mean roughly 4 significant figures. Because this seems non-intuitive, MathObjects went with non-percentage values. This does lead to an inconsistency with the older routines, but for backward compatibility, that could not be helped. (The num_cmp tolerances used to be set via tol and relTol, not tolerance, so when MathObjects were original developed, the inconsistency was less obvious).
Note that num_cmp is deprecated in favor of the MathObject checkers.