Repository navigation
Check Tan's precision ceiling against the requested digits [patch] - #160
Merged
Merged
Conversation
Tan called the public SinCos at its widened working precision, so its ten guard digits were counted against the pi reduction ceiling and it refused precisions Sin and Cos deliver. SinCos is now a checked public wrapper over an unchecked SinCosCore; Tan checks the ceiling against the digits it reports and computes sin and cos through the core. Fixes #125 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VL7qukbkUpkVRArT45bBFb
|
This was referenced Oct 7, 2026
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.



Fixes #125
Before:
Tan(x, n)called the publicSinCos(x, n + 10). That counted its 10 guard digits against the π reduction ceiling. As a result,Tan(1, 140),Tan(1, 145)andTan(0.3, 145)threw, even thoughSinandCosdeliver those precisions.After:
SinCos(x, n)is now a checked public wrapper around a private, uncheckedSinCosCore.TancallsRequireReducibleArgumentagainst thendigits it reports, then gets sin and cos from the core at the wider working precision. This follows theRequireReducibleArgumentremarks and CLAUDE.md: guard margin is allowed to be unavailable.Tan's docs now list the ceiling exception.Tests:
TestTanDeliversEveryDigitUpToTheReductionCeiling:Tan(1000000, ConstantPrecision - 7)succeeds and matchessin/cos, and one digit more is still refused.TestTanAcceptsThePrecisionsSinAndCosAccept: the repro from the issue.Tan(1, 145)returns 145 digits and starts with the published tan(1) digits.Tan(0.3, 145)andTan(0.3, 150)also succeed.mainand pass with the change. Full suite: 442 passed, 0 failed.This PR is independent of #159 (#124), which clamps the default-precision overloads. I merged the two branches locally to check them together:
Tan(Pi / 4)agrees with 1 to 140 digits, andTan(Pi)andTan(E)no longer throw. Each change alone isn't enough for those.🤖 Generated with Claude Code
https://claude.ai/code/session_01VL7qukbkUpkVRArT45bBFb
Generated by Claude Code