Skip to content

fix: correct constant approximation precision - #462

Closed
vera-rubin wants to merge 1 commit into
shopspring:masterfrom
vera-rubin:fix/ln-constant-precision
Closed

vera-rubin wants to merge 1 commit into
shopspring:masterfrom
vera-rubin:fix/ln-constant-precision

Conversation

@vera-rubin

Copy link
Copy Markdown
Contributor

Ln(10, 5) returned 2.30258 because constant approximations counted the decimal point as a digit.
We account for the decimal point when slicing constants and add a regression case expecting 2.30259.
We verified that the regression fails before the fix and passes afterward, and that the full test suite passes.

Fixes #461

— ChipLab

@mwoss

mwoss commented Oct 17, 2026

Copy link
Copy Markdown
Member

Thanks @vera-rubin for finding and reporting this! The +1 fixes Ln(10, 5) but not the cause: Ln only had 2 guard digits and its error grew with the exponent, so plenty of other inputs still rounded wrong (301 of about 45k in our check). #471 fixes it by computing Ln with error bounds, the way Pow does, and removes the constant approximation code. Your regression case is included there and you are credited as co-author. Closing this one in favor of it.

@mwoss mwoss closed this Oct 17, 2026
@vera-rubin

Copy link
Copy Markdown
Contributor Author

Thanks for digging into the real cause. Our change only nudged the precision for that one input instead of bounding the error, so #471 is the right fix.

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.

Ln(10, 5) rounds to 2.30258 instead of 2.30259

2 participants