-
Notifications
You must be signed in to change notification settings - Fork 84
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
Cash Register Demo - floating-point error #559
Labels
bug
Something isn't working
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Demo of the Cash Register project has issue with the floating-point error. Causing it display values with error, and in certain situations, for remaining cash to go below
$0
.To Reproduce
330
and submit.10
and submit.4
and submit.4
and submit.At the step 3. value below status will include the number with clear floating-point error.
After step 5. in register Nickels are below
$0
.Expected behavior
Cash shouldn't go below
$0
, or be displayed with more than a dozen of digits after the dot.Screenshots
Additional context
The least time-absorbing solution is adding
toFixed(2)
method to two more places:demo-projects/apps/cash-register/public/script.js
Line 66 in a712591
demo-projects/apps/cash-register/public/script.js
Line 70 in a712591
More robust option is saying no to floats and changing more internals to not do calculations on floats.
The text was updated successfully, but these errors were encountered: