]> git.mjollnir.org Git - moodle.git/commitdiff
Added "$factor = round($factor * 1000.0) / 1000.0;"
authormartin <martin>
Fri, 12 Apr 2002 13:20:17 +0000 (13:20 +0000)
committermartin <martin>
Fri, 12 Apr 2002 13:20:17 +0000 (13:20 +0000)
to function find_range ... it fixes some strange rounding
errors that were happening with Moodle surveys.

lib/graphlib.php

index 8cc39b38cfda8aa537990a33af37fd9ce6531d5d..f742f45ce756b718bf20a92615b1d34becf6c0d0 100644 (file)
@@ -1110,6 +1110,7 @@ function find_range($data, $min, $max, $resolution) {
     if ($max < 0) $factor = - pow(10, (floor(log10(abs($max))) + $resolution) );\r
     else $factor = pow(10, (floor(log10(abs($max))) - $resolution) );\r
   }\r
+  $factor = round($factor * 1000.0) / 1000.0; // To avoid some wierd rounding errors (Moodle)\r
 \r
   $max = $factor * @ceil($max / $factor);\r
   $min = $factor * @floor($min / $factor);\r