Repository navigation
[VFDLIBM-33] Port atan2 from fdlibm - #121
Merged
Merged
Conversation
added 2 commits
November 21, 2026 21:39
Generated-by: Claude Code (Fable 5.2)
# Conflicts: # CHANGELOG.md # PLAN.md # PROOFS.md # README.md # SKILLS.md # dev/jar-check.sh # src/main/java/io/github/vecbricks/vfdlibm/VFdlibm.java
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.
Purpose
Part of #33. Ports
atan2from fdlibm 5.3'se_atan2.c, the first function of two arguments, on the pair harness (PairFunction,OPERANDSfor a lane of two NaNs,pair-passes,--argument,wordGaps). Not added to the nightly'sall=: a later PR does that after a night has been read.What changed
Atan2andVFdlibm.atan2(y, x)/atan2(y, x, live)(a lane that is not live keepsy). The special lanes (NaN, zeros, infinities, the diagonals) are blends over the general path, from the C's last test to its first. The general path isAtan.atanont = |y/x|wheret < 2^66, then the quadrant by sign; the shortcutsk > 60andhx < 0 && k < -60and thex = 1.0early return follow the C. No lane is finished by a call toStrictMath. Two arms (blended, andguarded, whichVFdlibmcalls provisionally; no timing ofatan2exists, so none is compared).PROOFS.md: what atan's core contract is (read before calling it), L14 (x = 1.0through the general path isatan(y)) with its hinge test, and the observation that moving either shortcut ofkby one changes no bit (so the planted faults move them by ten).CATCHERSandpom.xmlexecutions, sized on 2^22 draws (SKILLS.md);hard-cases/atan2.txtread throughInputs.hardCasePairs;Nightly.PairFunction.ATAN2(two arms,OPERANDS,wordGapsat thekthresholds); thedev/jar-check.shconsumer callsatan2with the candidates rule;Atan2Benchmark(blendedandguarded,*256,*Preferred,*Max,commonandmixed, refusing another value);Fuzz.PairEdges.wordGaps()returns a copy, with a test; CHANGELOG, README, PLAN, SKILLS.How it was tested
Atan2Test(50 cases at every width andSPECIES_MAX, masked and not, three arms, special pairs,kthresholds,x = 1.0, subnormalx, sampled, dense, the 20,820 hard-case pairs, every subset of lanes special) and the eight fault executions pass; the wholemvn testpasses locally.bench/alloc-check.pypasses on theAtan2Benchmarkrows at this host's flags and as an AVX2 host; CI runs it.Sweepof both arguments over 2^24 high words andFuzzof 4 million draws matchedStrictMath.Compatibility
Adds
VFdlibm.atan2. Its lanes equalStrictMath.atan2's by raw bits except a lane where both arguments are NaN with different bits, which is one of the two, quieted (the decision on #33; theCLAUDE.mdand CHANGELOG header wording stays the owner's, drafted on #115).AI tooling
Generated-by: Claude Code (Fable 5.2)