mirror of
https://github.com/moodle/moodle.git
synced 2025-02-22 19:06:51 +01:00
Better fix for bug 3225 that is reading the precision setting from php.ini, contributed by Paulo
This commit is contained in:
parent
187db9ddfe
commit
223ad0b94b
@ -346,10 +346,10 @@ class question_numerical_qtype extends question_shortanswer_qtype {
|
||||
$answer->tolerancetype = 2; // nominal
|
||||
}
|
||||
|
||||
// We need to add a tiny fraction (0.00000000000000001) to make the
|
||||
// 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 + 0.0000000000001;
|
||||
$tolerance = (float)$answer->tolerance + ("1.0e-".ini_get('precision'));
|
||||
switch ($answer->tolerancetype) {
|
||||
case '1': case 'relative':
|
||||
/// Recalculate the tolerance and fall through
|
||||
|
Loading…
x
Reference in New Issue
Block a user