Repository navigation
Conversation
`atanh( 1/x )` loses the low bits of `1-|1/x|` to the rounding of `1/x`: `acoth( 1.000000001 )` was off by about 2.8e5 ULPs. For `1 <= |x| <= 2`, evaluate `sign(x) * log1p( 2/(|x|-1) )/2` instead, where `|x|-1` is exact. The fixtures were generated with Julia's Float64 `acoth`, which is also `atanh(inv(x))`; they are now evaluated in BigFloat, with new sets of values close to 1 and -1. 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. |
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/acothassign(x) * log1p( 2/(|x|-1) )/2for1 <= |x| <= 2(JS and C), instead ofatanh( 1/x ).atanh( 1/x )depends on1 - |1/x|, and rounding1/xloses its low bits:acoth(x) = log( (x+1)/(x-1) )/2 = log1p( 2/(x-1) )/2, andx-1is exact for1 <= x <= 2.acoth(±1)still returns±Infinity. Elsewhere the function is unchanged.BigFloat. They were generated with Julia'sFloat64acoth, which is alsoatanh(inv(x)), so the reference values carried the same error. Against the exact values, the medium and large sets need 2 ULPs (they were checked at 1). The large set covers3 <= |x| <= 28, which this PR doesn't touch, so those 2-ULP differences were already there.near_positive_one.jsonandnear_negative_one.json, 1000 values each at±(1 + 10^k)forkin[-15, -1]. They pass at 1 ULP.Related Issues
None. It is the same construction as #16110 (
asech);asecandacscfollow.Questions
No.
Other
test.jsandtest.native.jspass.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?