Repository navigation
Conversation
`acos( 1/x )` loses the low bits of `1-1/x` to the rounding of `1/x`, and near one those bits are most of the result: `asec( 1.000000001 )` was off by about 3.3e6 ULPs. For `1 <= x <= 2`, evaluate `atan( sqrt((x-1)*(x+1)) )` instead, where `x-1` is exact. The fixtures were generated with Julia's Float64 `asec`; they are now evaluated in BigFloat, with a new set of values close to one. Signed-off-by: Abhist17 <abhistkamle.170903@gmail.com>
6 of 7 tasks
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Abhist17
marked this pull request as draft
October 14, 2026 04:16
This branch has not been deployed
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.
Description
This pull request:
math/base/special/asecasatan( sqrt((x-1)*(x+1)) )for1 <= x <= 2(JS and C), instead ofacos( 1/x ).Near one the result is small, and
acos( 1/x )takes it from1 - 1/x, whose low bits are lost to the rounding of1/x:For
x >= 1,tan( asec(x) ) = sqrt(x^2-1), andx-1is exact for1 <= x <= 2. Near-1the result is close toπ, so the relative error there was already small, and that side is unchanged.BigFloat(they came from Julia'sFloat64asec). The existing sets still pass at their current tolerances.near_one.json, 1000 values1 + 10^kforkin[-15, -1], which pass at 2 ULPs.Related Issues
None. Same construction as #16110 (
asech) and #16111 (acoth).Questions
No.
Other
test.jsandtest.native.jspass.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?