Skip to content

Commit

Permalink
Merge branch 'MDL-28202' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 26, 2011
2 parents 8374ca3 + aecb339 commit e75f06d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions question/type/calculated/questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,12 @@ function qtype_calculated_calculate_answer($formula, $individualdata,
// ... and have the answer rounded of to the correct length
$answer = round($answer, $answerlength);

//if we rounded up to 1.0, place the answer back into 0.[1-9][0-9]* format
if ($answer >= 1) {
++$p10;
$answer /= 10;
}

// Have the answer written on a suitable format,
// Either scientific or plain numeric
if (-2 > $p10 || 4 < $p10) {
Expand Down

0 comments on commit e75f06d

Please sign in to comment.