Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0.4, 2.1.1, 2.2
-
Component/s: Questions
-
Labels:
-
Testing Instructions:
-
Affected Branches:MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
Fixed Branches:MOODLE_20_STABLE, MOODLE_21_STABLE
-
Pull from Repository:
-
Pull Master Branch:
-
Pull Master Diff URL:
Description
When using the significant figures calculation mode, an edge case is not properly handled in the function 'qtype_calculated_calculate_answer', causing the calculated answer to be incorrect.
The function works to ensure the answer is expressed as a string of the format "0.[1-9][0-9]*", but subsequently calls the round() function. In some cases, round will round up to 1.0- which is no longer in the assumed format. This causes an answer to be produced which is exactly 10x larger than the correct answer.
A special case should be added to compensate, as in the attached patch.