Skip to content

Prevent exponential precision growth in division #325

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

Conversation

Confusion
Copy link

Solves Github issue #222.

Currently repeated division of a number can cause memory use to spike due to the precision of that number growing exponentially. A solution, also employed by various other arbitrary arithmetic libraries, is to only allow the precision to grow with a constant number of digits per operation.

The constant was chosen somewhat arbitrarily by me; I'm not sure what would be good reasons to use e.g. 50 or 200 or ...

Solves github issue ruby#222.

Currently repeated division of a number can cause memory use to spike
due to the precision of that number growing exponentially. The solution,
also employed by various other arbitrary arithmetic libraries, is to
only allow the precision to grow with a constant number of digits per
operation.
@mrkn
Copy link
Member

mrkn commented May 29, 2025

#329 fixed the problem without introducing the precision limit, so I'm closing this issue. Thank you for your contribution!

@mrkn mrkn closed this May 29, 2025
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