fix(libc): preserve frexp decomposition and exception behavior #11077
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11077"
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?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-25T17:11:07Z.
What
The host
std::frexp(double)quiets signaling NaNs and does not reproduce the bundled implementation's subnormal scaling/DAZ behavior.frexpnow decomposes exponent bits directly, scales only subnormal inputs by2^54, and returns zeros/infinities/NaNs unchanged with exponent0. This follows both supplied PPSA03766/PPSA07923 functions. Existing ABI and export identity are unchanged.Tested
Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head
fa653e8c08153c828419adfa1c029ad3488917b3on tested main3fea2a937ba9fbab2f06c51691fe0c5763659aa3. The topic implementations and fixtures are retained alongside current main's newer math functions and coverage.Linux Release focused rebuild:
guest_mathandguest_math_exacteach pass three repetitions: 6 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain.Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts. SHA-256:
702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c; downloaded copy verified.Current-main refresh: head
f3f75dade024d94529c6d51f9071a518e4f70264is one linear commit on maina7a2eece499ef8925c93765dbbcc9f4d9461a2f0. The only rebase conflict was additivedocs/dev/debt/libc.md; all upstream rows and this gap entry are retained. Production and960-call regression function bodies are byte-identical to61a9072bbb. All three focused suites pass3 repeats on the refreshed head; the parent host-call negative fails at the first subnormal's flags, and restoration passes3 repeats with a byte-identical library. Conventions/whitespace pass. The #11074-first merge-order dependency is unchanged.Refresh logs, negative/restored runs, patch and preservation proof — SHA-256
f4741a30cb14e0c1b36c9be7fe301445e39b593cfdce9a683a098853f640f5ba, downloaded/hash-verified. The earlier broad numeric matrix below remains pinned to61a9072bbb; no new broad matrix or platform/title result is claimed.Original qualification:
Linux / GCC16.2.1 / Release, exact head
61a9072bbbc19780adadc7d7b339ab04a50f8e63on main4718dedcf8415e462bd2bb6dc218142d81edd8f1.guest_math,guest_math_exactandguest_dinkumware_internals: each passes3 repeats before and after the selective negative control.guest_mathregression fail at the first subnormal's flags. Restoring the change passes the suites and reproduces the libc SHA exactly.Related #11074 changes float
frexpf, independently of this double implementation. They have an adjacentMath.cppconflict. I resolved that in private integrationf014a32788fdd53cb4dac543006d9fbfb8178fdc, retaining both exact function bodies, both fixtures/calls and both debt entries; all three groups pass3 repeats. The archive includes the integration delta and proof. I then restored this standalone head, repeated all three groups3 times and verified its library byte-identical. I will preserve both functions when refreshing after either lands. Merge order is #11074 first, then this PR. I will recheck/rebase the combined tree after #11074 lands; this is a merge-order dependency, not a functional one. #9613's reported overlap is an independent additive debt entry; retain both rows. The other shared-file patches introduce no competingfrexpimplementation; their combinations were not runtime-tested.Conventions/whitespace pass. Clean local merge-tree against newer main
4da123784ed160db849f1c72ec61dd0484708952; exact built/tested base remains4718.Source patch, full numeric matrices, reference fingerprints, negative/restored test logs and float-combination evidence — SHA-256
2580e06d06628077746e7dd4bbad28e1b3aeda886994ee6dc954eb849cf045aa. Original module binaries, extracted instruction bytes and game assets are excluded.Windows/macOS, unmasked traps and native games were not tested. No FPS, title-unblock or newly implemented export claim.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)d090e628413c; present in audited main3fea2a937ba)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:23:40Z.
Review: APPROVED
Reviewed the exact
frexpbit decomposition and the environment regression matrix. The subnormal path is deliberately exposed to DAZ, while the result/exponent construction and unchanged special-value return avoid hostfrexpbehavior; the tests check rounding, DAZ/FTZ, sticky flags, errno, signed zeros and signaling/quiet NaNs. GCC 12.2 syntax compilation passed forMath.cppandGuestMath.cpp; conventions andgit diff --checkpass locally. The author reports repeated focused runtime suites, a negative control and the broader differential matrix. The current main has no changes to these three touched paths since the tested base, and the merge tree is clean. Merge order remains after #11074 as declared.