fix: bits_float quiets signalling NaNs on every Python version (3.14 keeps them) #238
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!238
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/238/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@lcg007xd-c on GitHub · 2026-11-25 20:46 UTC · original
lcg007xd-c:fix/f32-nan-quiet-python314→main· +24 −1 · 2 files · 1 commits · merged 2026-11-25 21:08 UTCChange
The reference interpreter relies on CPython quieting a signalling f32 NaN when
struct.unpack("<f")widens it to a double (_first_naninemu/rdna2_exec_ops.py: "déjà rendu silencieux par la conversion en double"). CPython 3.14 no longer does: it keeps the signalling bit throughstruct. Measured with the same one-liner (struct.unpack("<f", struct.pack("<I", 0x7F800001)), thenstruct.pack("<f", …)):So on Python 3.14,
main(4f2cf5c) fails 4 FMA tests: the FMA returns the signalling NaN instead of the quiet one.Now
bits_floatsets bit 22 itself when the pattern is a NaN, so every Python version follows the rule that the 3.12 CI already checks against the GPU. Infinities, quiet NaNs and ordinary values are unchanged. Nothing changes on 3.12 or 3.13.Linked issue: none.
Verification
Linux (Arch), no C++ runtime, no GPU (the runtime and GPU tests skip):
The 2 remaining failures are
tests/test_jour_j.py(manifest name case on Linux, fixed separately in #237), the same on both versions.Not run: the Windows CI job and the GPU/WARP parity tests (no HLSL change).
Oracle and test data
test_signalling_nan_operands_come_back_quiet_on_every_python(tests/test_rdna2_exec_fma.py): signalling NaNs of both signs and the largest payload come back with bit 22 set; a quiet NaN, ±infinity and 1.0 are unchanged.tests/test_rdna2_exec_fma.pyhas 7 failures (the 4 above and 3 of the new cases). On 3.12 the new test also passes without the change, because 3.12 already quiets.Checklist
E_NOTIMPL), never a fake success.test_readme_sync.pychecks it). (No README change; still1300+.)Made with AI assistance (Claude Code).
🤖 Generated with Claude Code
The interpreter relied on CPython turning a signalling f32 NaN quiet when struct.unpack("<f") widens it to a double (_first_nan says so). CPython 3.14 keeps the signalling bit: unpack then pack of 0x7F800001 gives 0x7F800001 on 3.14.10 and 0x7FC00001 on 3.12.13 and 3.13.13. On 3.14 the FMA NaN cases of tests/test_rdna2_exec_fma.py returned the signalling NaN (4 failures on main). bits_float now sets bit 22 of a NaN pattern itself, so every version follows the rule the 3.12 CI already checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>