-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
3.4.8, 4.1.2
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:
- Create a course with a total of 331 points.
- Assign a student points totaling 297.9.
- Make sure the grade scales is set to A- for a 90% or above.
- The 'real' grade value shows 90%, however the letter grade is B+.
- It appears PHP is calculating this similar to Python.
>>> 297.9/331
0.8999999999999999 - This should be .90.
- 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.
Docs which need updating if this patch is accepted: https://docs.moodle.org/402/en/Gradebook_calculation_changes