Skip to content

Add tests for bigfraction.js round() #49

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

Closed
wants to merge 1 commit into from
Closed

Conversation

andrefs
Copy link

@andrefs andrefs commented Feb 3, 2022

I've added 3 tests:

  1. One with a big numerator, previously complained about Infinity, now ok ✔️
  2. One with big numerator and denominator, previously complained about NaN (due to attempted division of Infinitys), now ok ✔️
  3. One with a big places, which is now failing ❎ Not sure whether supporting BigInt places is a reasonable use case 😅

@infusion
Copy link
Collaborator

infusion commented Feb 3, 2022

I wouldn't go beyond reasonable decimal places count. I can't think of a use case for that.

Why do you expect your 3rd case with "'409652136432929109317'.repeat(100) / 10" to be -1 and not '409652136432929109317'.repeat(99) + '40965213643292910932'

@infusion
Copy link
Collaborator

infusion commented Feb 3, 2022

I added those two working test cases. The case with many decimal places ca be worked out when someone has a use case for it :D

@andrefs
Copy link
Author

andrefs commented Feb 3, 2022

Why do you expect your 3rd case with "'409652136432929109317'.repeat(100) / 10" to be -1

Nevermind, I forgot to update it when I copied it from another test case

The case with many decimal places ca be worked out when someone has a use case for it :D

Sounds cool, thanks, this was great! 😎

@andrefs andrefs closed this Feb 3, 2022
@infusion
Copy link
Collaborator

infusion commented Feb 3, 2022

Thanks for bringing this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants