Skip to content
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

Open
gikf opened this issue Dec 28, 2023 · 1 comment · May be fixed by #560 or #564
Open

Cash Register Demo - floating-point error #559

gikf opened this issue Dec 28, 2023 · 1 comment · May be fixed by #560 or #564
Labels
bug Something isn't working

Comments

@gikf
Copy link
Member

gikf commented Dec 28, 2023

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

  1. Go to https://cash-register.freecodecamp.rocks
  2. Enter 330 and submit.
  3. Enter 10 and submit.
  4. Enter 4 and submit.
  5. Enter 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
image

Additional context

@gikf gikf added the bug Something isn't working label Dec 28, 2023
@obafemitayor
Copy link

Created a PR to fix this
#560

@a2937 a2937 linked a pull request Jan 27, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants