Permalink
Browse files

Added "$factor = round($factor * 1000.0) / 1000.0;"

to function find_range ... it fixes some strange rounding
errors that were happening with Moodle surveys.
  • Loading branch information...
1 parent e7c7519 commit c4bb2bd0eeb4b91dfbfc4fcfd57a2cad5ba799e8 martin committed Apr 12, 2002
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/graphlib.php
View
@@ -1110,6 +1110,7 @@ function find_range($data, $min, $max, $resolution) {
if ($max < 0) $factor = - pow(10, (floor(log10(abs($max))) + $resolution) );
else $factor = pow(10, (floor(log10(abs($max))) - $resolution) );
}
+ $factor = round($factor * 1000.0) / 1000.0; // To avoid some wierd rounding errors (Moodle)
$max = $factor * @ceil($max / $factor);
$min = $factor * @floor($min / $factor);

0 comments on commit c4bb2bd

Please sign in to comment.