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

to function find_range ... it fixes some strange rounding
errors that were happening with Moodle surveys.
This commit is contained in:
martin
2002-04-12 13:20:17 +00:00
parent e7c75196f9
commit c4bb2bd0ee
+1
View File
@@ -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);