Repository navigation
Round Log in a base, Log2, Log2P1 and Log10P1 to the digits asked for [patch] - #183
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
… [patch] Each finished with Divide, which returns a terminating quotient exactly and ignores significantDigits, so Log(1E5, 1E4, 1) returned 1.25. Use DivideApproximation, as Trigonometry and Roots already do. Fixes #147 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4sAxuwubJA58cavro
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Log(x, newBase, digits),Log2,Log2P1andLog10P1each finished withDivide(…, significantDigits).Dividereturns a terminating quotient exactly and ignores the precision argument, soLog(1E5, 1E4, 1)returned1.25, three digits for a one-digit request. These four now useDivideApproximation, which Trigonometry and Roots already use for the same reason.Tests
TestLogInABaseRoundsATerminatingQuotientToTheDigitsAskedForpinsLog(1E5, 1E4, n)at 1, 2 and 3 digits (1,1.3,1.25; rounding is half away from zero), plus the non-terminatingLog(1E7, 1E4, 2) = 1.8.TestDividedLogarithmsNeverReturnMoreDigitsThanAskedForsweeps 1 to 64 at 1 to 4 digits through all four methods.Both tests fail on
mainand pass with this change. In a probe over integers up to 2000 and thousandths up to 20, only the chosen-base path produced a terminating quotient, so forLog2,Log2P1andLog10P1the sweep is a guard rather than a reproduction. Those three are changed to keep the four call sites consistent, as the issue asks.Full suite: 550 passed, 0 failed.
Fixes #147
Generated by Claude Code