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

Fix addition #63

Merged
merged 1 commit into from
Oct 13, 2024
Merged

Fix addition #63

merged 1 commit into from
Oct 13, 2024

Conversation

barucden
Copy link
Collaborator

@barucden barucden commented Oct 2, 2024

The addition did not work for two numbers with exponents q1 and q2 such that d = abs(q1 - q2) > 18 because it led to a power 10^d which overflows for d>18. This commit makes that 10 a BigInt to prevent overflow.

Besides that, the code is simplified a little.

Fixes #62

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.22%. Comparing base (44b6616) to head (5f9c5b0).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   99.21%   99.22%           
=======================================
  Files           6        6           
  Lines         128      129    +1     
=======================================
+ Hits          127      128    +1     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The addition did not work for two numbers with exponents `q1` and `q2`
such that `d = abs(q1 - q2) > 18` because it led to a power `10^d` which
overflows for `d>18`. This commit makes that `10` a `BigInt` to prevent
overflow.

Besides that, the code is simplified a little.

Fixes JuliaMath#62
@tinybike tinybike merged commit 0180ccc into JuliaMath:master Oct 13, 2024
8 checks passed
@tinybike
Copy link
Member

Hello @barucden, as mentioned in the other thread, until we can get you set up as a maintainer, I'm happy to merge in PRs that you think are ready, as it seems that this library is substantially broken currently.

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.

Wrong result when adding two decimals
2 participants