Details
-
Sub-task
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8
-
None
-
None
-
MOODLE_18_STABLE
Description
When the answer is a small number i.e 1e-19 as the charge of the electron the range of the allowed answer can extend to negative value given the fact that the code of add +- a small number
line 355 of numerical/questiontype.php in the function get_tolerance_interval(&$answer) {
// We need to add a tiny fraction depending on the set precision to make the
// comparison work correctly. Otherwise seemingly equal values can yield
// false. (fixes bug #3225)
$tolerance = (float)$answer->tolerance + ("1.0e-".ini_get('precision'));
This is to remediate for the 0.000000001 or .999999999 possible output of real number functions.
So if the user put an answer like 1.6e-5 php code could sometimes see it 0.0000159999999 or 0.00001600000001
for small answer values the tiny fraction should be calcualted as a fraction of the number and not an absolute value
actually ("1.0e-".ini_get('precision')); can gives something like 1e-13 for a precision of 8 .
After completing tests, a working solution will be proposed soon
Attachments
Issue Links
- is duplicated by
-
MDL-12375 Improving the grading of calculated question when there numbers are near the testing limit
-
- Closed
-