WeBWorK Main Forum

relative v. absolute tolerance in Real answers: weird quirk

relative v. absolute tolerance in Real answers: weird quirk

by Andrew Dabrowski -
Number of replies: 0

Attached is an MWE of a weird quirk in answer scoring.  There are three questions: the answers are

  1. 1
  2. 0.0001
  3. 0.0001.
But WW accepts things like 0.00001, 0.000001, etc. for answers 2 and 3.  This would make sense if the tolerance were absolute, but it shouldn't be: the default for Reals is supposed to be relative, yes?

Even weirder: removing the multipart scaffolding makes the behavior change: it then seems to revert to relative tolerance.

I suspect part of the issue is the line

$answer_evaluator_1 = (num_cmp($ans[0], mode=>'strict', tol=>0.5))[0];

I don't understand what the "[0]" is doing at the end - this is legacy code written decades ago.

I think this may be a very obscure bug.