From 2784b982782a732ad258bb53572852c058d6d91e Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 13 Apr 2006 10:29:20 +0000 Subject: [PATCH] Don't compare floats for equality! Bug #5176 --- lib/questionlib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index 90f6b22863..75a044a454 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -260,7 +260,8 @@ function match_grade_options($gradeoptionsfull, $grade, $matchgrades='error') { // if we just need an error... if ($matchgrades=='error') { foreach($gradeoptionsfull as $value => $option) { - if ($grade==$value) { + // slightly fuzzy test, never check floats for equality :-) + if (abs($grade-$value)<0.00001) { return $grade; } } -- 2.39.5