Skip to content

Preserve Rational precision near one in BigMath.log - #559

Open
Boulea7 wants to merge 1 commit into
ruby:masterfrom
Boulea7:fix/log-rational-near-one
Open

Boulea7 wants to merge 1 commit into
ruby:masterfrom
Boulea7:fix/log-rational-near-one

Conversation

@Boulea7

@Boulea7 Boulea7 commented Oct 4, 2026

Copy link
Copy Markdown

BigMath.log can lose significant digits or return zero when a Rational input is very close to one. Convert its exact difference from one with guard precision and use an explicit precision when adding one back, preserving the offset when BigDecimal.limit is set.

Validated locally with rake test on Ruby 3.4.10: 274 tests, 13,074 assertions.

Refs #444 (the BigMath.log case).

Change-Id: I7b0a9b59474014d587253e73eeb9106a86caa00a

This branch has not been deployed

No deployments
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.

1 participant