Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65182

Gradebook incorrectly calculates letter grade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Development in progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.4.8
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      php admin/tool/behat/cli/init.php
      php admin/tool/behat/cli/run.php --feature="/var/www/html/grade/tests/behat/grade_letter_boundary_float_accuracy.feature"

      Show
      php admin/tool/behat/cli/init.php php admin/tool/behat/cli/run.php --feature="/var/www/html/grade/tests/behat/grade_letter_boundary_float_accuracy.feature"
    • Affected Branches:
      MOODLE_34_STABLE
    • Pull from Repository:

      Description

      There is a bug where a letter grade is not calculated correctly due to floating point division. (floating point division by reciprocal multiplication).

      Reproduction Steps:

      1. Create a course with a total of 331 points.
      2. Assign a student points totaling 297.9.
      3. Make sure the grade scales is set to A- for a 90% or above.
      4. The 'real' grade value shows 90%, however the letter grade is B+.
      5. It appears PHP is calculating this similar to Pyhon.
        >>> 297.9/331
        0.8999999999999999
      6. This should be .90. 
        1. 297.9 / 331 equals exactly 90%.

      There are a number of tracker issues open related to rounding decisions. However ,this case seems to be a legitimate bug related to floating point division rather than a choice of rounding vs. truncating calculated values.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              mikehas mikehas
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 minute
                  1m