You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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: