WeBWorK Problems

error in parserNumberWithUnits.pl?

error in parserNumberWithUnits.pl?

by Carl Yao -
Number of replies: 1
Hi community:

Please see attached pg file and a screen shot. Notice the error in the Correct Answer field, when a student erroneously enters "ft^2" as the unit. The correct unit is "ft". Somehow the Correct Answer field outputs a wrong number.

Thanks!

Carl Yao
Portland Community College
In reply to Carl Yao

Error in parserNumberWithUnits.pl?

by Alex Jordan -
If I could elaborate on the issue:

This problem is using parserNumberWithUnits.pl. The first correct answer is a length unit: my seed makes the answer be NumberWithUnits("235 ft").

Because the problem later gets into areas, and students can have a poor understanding of units, a student might try "235 ft^2". If they do, the answer is wrong and they get the feedback message that "the units for your answer are not correct", which is good. The problem is that now the "correct answer" field displays "770.997 ft" rather than "235 ft".

Note that 770.997 = 235 * 3.2808..., and 3.2808... is the number of feet in one meter. Units.pm works at its base level in terms of meters, and then has feet as a dependent unit. So there is some kind of bug involving unit conversion and either correct_ans or correct_ans_latex_string.

To keep this all in one thread, I'm posting the .pg file that demonstrates the issue.