-
-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Progress] Fix to validate the sum of the percents before rounding #759
Conversation
The problem is: The rounding issues are a general Javascript problem. If we don't round them before comparing (it's actually correction instead of rounding to avoid values like 100.000000003 because of multiplication and division with the same value at the same time) the comparison probably always fails |
@ryamaguchi0220 Your PR does not fix the example of your given jsfiddle when the sum is definately exceeding the total value (325+1, 111, 74, 612 =1123, but total given is 1122) , which of course gives a percentage > 100% (regardless of the rounding) Testcases with sum(values) > given totalAll fixes break because the sum of all values definaltey exceed the given total sum regardless of any rounding order or precision calculation
BUTTestcases with sum(values) = given total... what your PR indeed does fix is some behavior with the precision setting of 10. This currently still breaks in #758
@exoego You both should join forces for this precision issue 😉 |
@lubber-de Thank you for your review!
What I'd like to test in the jsfiddle(https://jsfiddle.net/562t0f3z/) is that if the sum of the |
Yes, definately. The console error in that case is correct and does not need a change |
Description
In addition to #758 , I think that we should validate the sum of the percents before rounding instead of after rounding, because, as the error message indicates, the validation is for
total
andvalue
as entered by the user.Testcase
https://jsfiddle.net/e0hvd7xo/
https://jsfiddle.net/562t0f3z/
Closes
#757