Repository navigation
Conversation
added 2 commits
November 21, 2026 20:52
VFdlibm.acos, in the two forms acos(x) and acos(x, live), from e_acos.c. The three ranges below 1 share one pass: z is x*x, (1+x)*0.5 or (1-x)*0.5 by the C's compares, the polynomials and r = p/q run on it in every lane, the root is VectorOperators.SQRT, the x >= 0.5 form divides a second time, and the C's own AND clears the root's low word. Lanes of magnitude 1 or more and NaNs are finished per lane by StrictMath.acos. One arm. PROOFS.md gets an acos section that says which of L13's hypotheses its blends meet and what it does not cover. The tests are AcosTest (every width, masked and unmasked, the 1569 published cases and their negations, every subset of lanes rare), four planted faults sized on 2^22 draws, AcosBenchmark for the allocation check, Fuzz's edges for acos and its entry in Nightly's table, which the night's list does not name yet. Generated-by: Claude Code (Sonnet 5.5)
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.
What changes were proposed in this pull request?
Part of #33. Ports acos from fdlibm 5.3's
e_acos.c:VFdlibm.acos(x)andacos(x, live), thesibling of asin.
The three ranges below 1 (
|x| < 0.5,x <= -0.5,x >= 0.5) share one pass:zisx*x,(1+x)*0.5or(1-x)*0.5by the C's compares, and the polynomials andr = p/qrun onzinevery lane. The root is
VectorOperators.SQRT; thex >= 0.5form divides a second time forc; the step__LO(df) = 0is the C's own AND of the bits with0xFFFFFFFF00000000, notarithmetic.
ix <= 0x3c600000returns the constantpio2_hi+pio2_lo. Lanes of magnitude 1 ormore and NaNs (exactly
1, exactly-1,(x-x)/(x-x)) are finished per lane byStrictMath.acos. There is one arm, so there is no default to choose.PROOFS.mdgets an acos section: no lemma of its own, which hypotheses H1 to H4 of L13 theblends meet, and what it does not cover. It also records, as one uncommitted scalar sample,
that the constant return's compare is not told from a neighbouring word by any test of the port,
so
acos.tinyMovedmoves it far enough to show. Four planted faults, each sized on 2^22 draws before it was wired (pio2_lodropped, the0.5 word moved to 0.75's, the low-word clear skipped, the constant return's word moved to
2^-50's; counts inSKILLS.md). Hard cases: the 1569 inputs of the tagacs, fromdev/testlibm-extract.py(the count is pinned inHarnessSelfTest); all are positive, so theirnegations reach the
x <= -0.5form.Fuzzhas edges at 2^-57, 0.5 and 1.Not in the nightly yet. acos is in
Nightly's function table (sodev/nightly.shruns it byhand and the planted-fault tests fuzz it) but not in the night's
all=list innightly.yml, asasin is: the list changes after the span is read.
Why are the changes needed?
acos is the next function in Varka's order (#33).
Does this PR introduce any user-facing change?
Yes: a new public method,
VFdlibm.acos, in both forms. Every lane equalsStrictMath.acosbyDouble.doubleToRawLongBits. ACHANGELOG.mdline is under Unreleased.How was this patch tested?
mvn -B verifypasses locally (every test and the four acos fault runs), anddev/jar-check.shpasses with acos in its consumer.AcosTestcompares every lane withStrictMathat 128, 256, 512 bits, the preferred species andSPECIES_MAX, masked and unmasked.bench/alloc-check.pypassed onAcosBenchmark'sfinish256,finishPreferredandfinishMaxrows, common and mixed data, at the host's flags and as an AVX2 host (
-XX:UseAVX=2 -XX:MaxVectorSize=32); those readings are not committed, and no speed is claimed.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Sonnet 5.5)