## WeBWorK Problems

### Re: interesting formulauptoconstant feature/bug

by Davide Cervone -
Number of replies: 0
It turns out that this error message is coming from when FormulaUpToConstant is trying to figure out what error messages to give the student, if any, when the answer is incorrect. The code uses adaptive parameters to decide if the student answer matches the correct one, and in this case, the adaptive parameters can't be found, and that produces a null result near the location of the warning message that you are seeing. Unfortunately, the code didn't check for that, and it should. An easy fix is to change
    my $result = Parser::Eval(sub {return$ans->{correct_value}  $student});  to  my$result = Parser::Eval(sub {return $ans->{correct_value}$student}) || 0;

at around line 300 of parserFormulaUpToConstant.pl.

When the student uses +c rather than +C, that means there is an extra variable (c in addition to C), and so the random points used are different, and so the numeric problem doesn't occur.