MCKIN-12690 Fix Score rounding - #267
Conversation
|
@xitij2000 Please review, merge and tag. |
|
@moeez96 Could you look into the failing tests? |
|
@xitij2000 Sure. failing tests seem like missing plugins. Does not looks like code failure |
I understand, but these same tests were passing before. I'm not saying this PR introduced the failures, just that each PR needs to maintain the current state of the code, so should leave the tests in a passing condition. |
$ python3.6 -c 'from decimal import *; print("\n".join("%.16e %7.3f %3d %3d" % (x, x, int((Decimal(x) * 100).quantize(Decimal('1.'), rounding=ROUND_HALF_UP)), int(Decimal(x*100).quantize(Decimal('1.'), rounding=ROUND_HALF_UP))) for x in [0.474, 0.475, 0.476, 0.484, 0.485, 0.486, 0.494, 0.495, 0.496]))'
4.7399999999999998e-01 0.474 47 47
4.7499999999999998e-01 0.475 47 48 # old 47, PR 48
4.7599999999999998e-01 0.476 48 48
4.8399999999999999e-01 0.484 48 48
4.8499999999999999e-01 0.485 48 49 # old 48, PR 49
4.8599999999999999e-01 0.486 49 49
4.9399999999999999e-01 0.494 49 49
4.9500000000000000e-01 0.495 49 50 # old 49, PR 50
4.9600000000000000e-01 0.496 50 50
This is a provisional 👍 Please resolve the following and then merge the PR:
|
|
@petarmaric I am unable to find the cause of failing tests. Also, FYI I do not have access to merge or create release tag. |
|
@xitij2000 Any thoughts on this ^ |
|
@moeez96 I'm unable to find a cause either. I'll create a separate ticket for this, and merge the PR as-is for now. |
Jira ticket: https://edx-wiki.atlassian.net/browse/MCKIN-12690
Python 3:
Decimal(0.485) = 0.4849999
Decimal(48.5) = 48.5
Due to above mentioned, rounding is in-accurate.
We need to multiply score by 100 before giving it as input to Decimal(xxx).