numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
197 stars 118 forks source link

Decimal values subbed into the answer for a mathematical expression part sometimes have scientific notation interpreted incorrectly #1027

Closed christianp closed 10 months ago

christianp commented 10 months ago

Minimal working example by @chrismgraham: https://numbas.mathcentre.ac.uk/question/145419/test-using-small-variable-with-e-directly-in-mathematical-expression/. In part a, the number as a decimal is dec("5.235987755982988333333333333333333333334e-1"). That string representation seems to be subbed in directly, leading it to evaluate 5.235987755982988333333333333333333333334e-1 = 13.2328903711, which is used as the final answer.

Scientific notation shouldn't be used when subbing a decimal value into the answer.