Hello,

first time poster. I'm a Webwork admin and teacher at a community college. A colleague is trying to use the following code but keeps on getting an error message when the wrong answer is entered. When the correct answer is entered there is no problem.

The error message is the following

`Use of uninitialized value in concatenation (.) or string at line 27 of [TMPL]/macros/fixedPrecision.pl`

`I believe the issue has to do with the custom answer checker. I've been making small tweaks to the answer checker, but don't seem to be able to get rid of the error.`

Would appreciate it if someone out there had some insight into this.

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"PCCmacros.pl",

"contextFraction.pl",

"PGcourse.pl",

"answerHints.pl",

);

##############################################

Context("LimitedNumeric");

loadMacros("fixedPrecision.pl");

$P = random(100, 950, 50);

$r = random(0.02, 0.1, 0.05);

$m = random(2, 4, 12, 365);

$t = random(1, 30);

$n = $t*$m;

$answer = $P*(1+$r/$m)**$n;

ANS(Compute(FixedPrecision($answer,2))->cmp->withPostFilter(AnswerHints(

sub {

my ($correct,$student,$ans) = @_;

return abs($correct-$student) < 0.5;

} => "Answers must be rounded correctly and have exactly two digits after the decimal."

)));

##############################################

TEXT(beginproblem());

BEGIN_PGML

Evaluate the expression for [`P = [$P]`], [`r = [$r]`], [`m = [$m]`], and [`n = [$n]`]. Round your answer to the nearest hundredth.

[`P {\left(1 + \frac{r}{m} \right)}^{n}=`] [_______]{$ans}

END_PGML

##############################################

BEGIN_PGML_SOLUTION

END_PGML_SOLUTION

ENDDOCUMENT();