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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix addition #63

wants to merge 1 commit into from

Conversation

barucden
Copy link

@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).

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
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
1 participant