From 223ad0b94bd62262a873b4deda76159b53ae749b Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Tue, 28 Mar 2006 07:39:36 +0000 Subject: [PATCH] Better fix for bug 3225 that is reading the precision setting from php.ini, contributed by Paulo --- question/type/numerical/questiontype.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index ec10b840b8..0e321cc8bb 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -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 -- 2.39.5