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

Issue with mathematical expression questions #1012

Closed ugonj closed 1 year ago

ugonj commented 1 year ago

Certain mathematical expression questions fail correct answers. For example, a simple question asking for $(-6)^n$ fails that answer. See here.

To reproduce:

  1. create a new question, with a new part, "Mathematical Expression".
  2. In correct answer, enter "(-6)^n".
  3. Run the question and enter (-6)^n in the box then submit.

Note that the "Testing" tab gives a few failures in the marking algorithm that might give a hint: either the algorithm is looking for a rhs component that doesn't exist, or for a ruleTree function/component that doesn't exist.

christianp commented 1 year ago

Thanks for reporting this. It turned out there was a bug in the logic for exponentiating a decimal value, which is used when you take an integer to a non-integer power.