fix(libc): preserve expm1 rounding during exponent scaling #10529
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10529"
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-24T08:19:38Z.
What
In the
expm1exponent-scaling branch,1 - (e - x)introduces a rounding point with the opposite sign from1 + (x - e). The two expressions agree under nearest and toward-zero rounding, but can differ by one ULP under upward/downward rounding. The bundled PPSA03766 and PPSA07923 libraries use the latter association.Change that one expression to
1 + (x - e). Other production paths are unchanged. For example, input0x407ff33f4d52628cunder downward rounding should return0x6e06c8c73526868f; main returns0x6e06c8c735268690.Contract source: PPSA03766 bundled
libc.prx, expm1 NIDgqKfOiJaCOo, scaling arithmetic at0x49936/0x4993a, checked against the unchanged function in the converted module and numerically against both bundled copies. No SDK instruction dump is attached.Tested
Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head
f89e32170ce3bc8fc785148b5236a1c81adaa6d2on 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 conflict refresh, 2026-10-27 UTC: exact head
3013efe5bef79c6866d7e2fae1848b10789d2886on tested main74acfad65b3f0fd4eab653f3a3989d298fba1157. Resolved overlapping test/debt context while preserving this branch's authored production/test edits and main's nextafter environment implementation and coverage. Existing prerequisite commits remain in their original series order.Linux focused rebuild of
libcand selected test executables passesguest_mathandguest_math_exact, each three times: 6 passes, zero skips. Conventions and whitespace checks pass. Final fetched maincb45ae2ddf6e113a4619e8fed91fe7b9333c5c0fmerges cleanly; its later change is an unrelated Windows crash-test pattern, and the executed qualification remains pinned to the stated base. No new Windows, console, GPU, title, full-suite or negative-control run is claimed. Earlier reference/Windows evidence keeps its original pins.Exact pins, branch patches, preservation proofs, build/test logs, JUnit and lease-push receipts for this refresh batch. SHA-256:
e33f98cc467f038af662cc5fa491c3acc1806bb47171cf77b748f0d4d052c1f2; downloaded copy verified.Current Linux rebase:
1f3b30246c95a935561c1f34c83a40607c4816de, one topic commit on main16ff208dc32cf3927ba1bae492eee363a5ae7ae8, without merge commits. Production and regression function bodies are unchanged fromaf0905fd62bff6da32102e36dcbf7a7510594968; main's merged log1p implementation, regressions and calls remain intact. Additive regression insertions were retained on both sides.Fresh Linux x86-64 Release:
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three repeats before and after the production-only main-Math negative control. The negative fails as expected while exact-math/Dinkumware controls pass; restored libc is byte-identical. Conventions and whitespace pass. The negative identifies the downward-rounding expm1 scaling case.Fresh exact-head logs, negative/restoration evidence and preservation proof (SHA-256
fba4546fd2ffc5ea33459b5cc498adc8d2844b835d01d33e301b09d530c93087). No new Windows/macOS, title/module matrix or performance result is claimed. Earlier independent reports below retain their original measured revisions.Previous qualification (historical source pins)
Historical main refresh:
af0905fd62bff6da32102e36dcbf7a7510594968, one topic commit directly on main8b426927d7d91c137e6f4704acc860f060a2798a, with no merge commits. The original Expm1 implementation and both expm1 regression functions are preserved; the entire production file equals main plus the original single-expression correction. Current public libc declarations are retained.Fresh Linux x86-64 Release: rebuilt libc and the three math targets.
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three repeats. A production-only main-Math control fails the intended downward-roundingexpm1 scaling: input=407ff33f4d52628c mode=1case; exact-math and Dinkumware controls pass. Restored candidate passes all four groups three times and restores byte-identical libc. Conventions/whitespace pass. No original-library matrix, Windows/title or performance run was repeated for this refresh.Exact-head logs, negative/restoration checks, source proof and patch, SHA-256
c718609d1f990bc2677789f2729d02799317405b61c28cbc8b7f57c484db6042.Historical independent Windows evidence: ycbuzi’s report tests prior head
b9e1b20e02integrated with mainfa515def85as clean73015c686e, Windows11 Home26200 / MinGW GCC15.2.0 Release. Math and Dinkumware pass twice; a main-Math negative aborts math while Dinkumware passes. No title was run. This is attributed historical integration evidence, not a new author-run Windows result.Earlier qualification (historical source pins)
Linux x86-64, GNU C++ 16.2.1, Release. Exact candidate
b9e1b20e0225a63d419ca01f7c9e231f0b3a8553on main1e20650e8458f4e8916a85576ae231b5e144b581; clean merge-tree check against current maine058b3284a1284449cafbf6423ce01bcd1153108.expm1 scaling; its Dinkumware suite passes 3/3.88f292c4c693af736bac15aba4f5fadd1e4d681fcombines this change with existing #10510/#10316/#10506. It has zero differences in all 127,344 expm1 and 79,104 tanh calls against both originals, including bits, errno, x87/SSE flags and controls. This also removes the previously documented sampled tanh discrepancy through the shared Expm1 helper. It is validation-only and is not part of this PR.04581076c482cf9788bbc79989b57d204b3f0618a85a274356d9d7ffd68812be. No SDK binaries, original code bytes or disassembly are included.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:10:18Z.
Review: APPROVED
Reviewed the exact one-expression change, its directed-rounding regression, and the reported comparison against both supplied modules. The changed association is isolated to the exponent-scaling branch; the regression exercises two exact inputs across all four rounding modes, DAZ/FTZ combinations, seeded sticky flags, errno and the saved floating-point control state. The reported original-module matrix is broad and its remaining overflow differences are explicitly separated as #10510. I attempted an exact-head local CMake configure, but it cannot proceed in this checkout because the SDL2 submodule content and XRandR development package are absent. The hosted relinker jobs pass; the full Linux/Windows jobs are skipped, so I rely on the detailed reported math-target builds rather than treating skipped CI as coverage.