Repository navigation
Name newBase, not x, when Log is given a base outside its domain [patch] - #197
Merged
Merged
Conversation
Log(x, newBase) passed the base to the single-argument Log, whose guard names x, so Log(5, -2) reported a bad x with the base's value, after working out Log(x) for nothing. Check each argument under its own name first. Fixes #196 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW3RtuaocwQ2QRF7djh
|
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.



Log(x, newBase, significantDigits)passed the base to the single-argumentLog, and that method's guard namesx. SoLog(5, -2)threwArgumentOutOfRangeExceptionwithParamName = "x"andActualValue = -2. It also worked outLog(5)to full working precision before throwing.The method now checks
xand thennewBase, each under its own name, before it computes either logarithm. Base one still throwsDivideByZeroException, as documented.Test:
TestLogInABaseNamesTheArgumentOutsideTheDomainchecks the following:Log(5, -2)andLog(5, 0, 20)namenewBase.Log(-5, 2)namesx.DivideByZeroException.Without the fix, the test fails on its first
ParamNameassertion. The full suite passes: 587 tests.Fixes #196
Generated by Claude Code