Skip to content

Route Log in a base's domain errors through DomainError [patch] - #205

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/log-base-domain-error
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/log-base-domain-error

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #202

What changed

Log(x, newBase, significantDigits) threw ArgumentOutOfRangeException directly for a non-positive x or newBase, passing the raw PreciseNumber as the actual value. Reading .Message then rendered it in fixed point, which throws OverflowException for an exponent like -2147483648 and produces a 100,087-character message for -1e-100000. Both checks now go through DomainError, as CLAUDE.md requires of every domain check.

Tests

  • PreciseNumberDomainErrorTests.TestDomainErrorMessageIsShortForAnExtremeExponent gains four rows: an extreme bad x (-1e-2147483648, -1e-100000), an extreme bad newBase (-1e-2147483648), and the three-argument overload with -1e2147483647. All four fail without the fix.
  • TestLogInABaseNamesTheArgumentOutsideTheDomain now expects ActualValue to be the rendered "-2E+000", as the other domain errors carry.
  • Full suite: 686 passed.

Generated by Claude Code

Log(x, newBase) threw ArgumentOutOfRangeException directly with the raw
PreciseNumber as its actual value, so reading .Message formatted it in
fixed point: an extreme argument threw OverflowException, and
Log(-1e-100000, 2) carried a 100,087-character message. Both checks now
build the exception through DomainError like every other domain check.

Fixes #202

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW4B4xxTAPzAHBD4zKk
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants