fix(libc): preserve expm1 overflow rounding and exception flags #10510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10510"
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-24T06:30:55Z.
What
Follow-up to #10306. Its
expm1finite-positive-overflow path useshuge * huge. Under downward and toward-zero rounding that returns the maximum finite double and leaves errno unchanged. Under every rounding mode it raises flags only in SSE. The bundled PPSA03766libc.prxinstead returns positive infinity, setsERANGE, and adds overflow/inexact flags in both x87 and SSE.Use the existing
_Feraise(0x08)helper and return positive infinity for that overflow path. Other paths are unchanged. Positive infinity input still preserves errno and flags.Tested
Latest integration (2026-11-05): head
45d2748496b7a62f315d36cf41ad850e4a98a508, tested on main1859e6af1cad6e19e0c79530bca8f4d6c1d43a82. This supersedes the integration pins in earlier reports below. Main now includes the atanh port #10315; its new regressions and the hypot regressions are retained alongside this PR's cases.Fresh Linux Release qualification: the actual libc CMake owner plus
guest_math,guest_math_exactandguest_dinkumware_internals, each repeated three times on main and this head, all pass with zero skips. The frozen branch math fixture fails with the baseline library and passes again with its own restored library. Conventions and whitespace pass; final merge preview against main6a337633c649805fb469960e53d43ec612e6e6d3is clean. Fresh validation is CPU-only; earlier Windows/module reports remain at their recorded pins.Source diffs, exact pins, actual-owner recipe, build/test/JUnit/control logs and binary/provider hashes, SHA-256
ad099369f7cae288f5353e8aeb196df80367b61ddc8454cf939a5dc522dbba1b(download verified). No new SDK-module sampling, whole-project, Windows or title-performance result is claimed.Current integration — 2026-11-05. Head
1441efcae16a063053c52d5d53769904c6350bc4includes pinned main6d173c1a19788ff69d43b3d0ca62833e312ef939and retains the previous public history, notices, main math implementations and actual prerequisites.Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables;
guest_math,guest_math_exactandguest_dinkumware_internalseach pass 3/3 (9 passes, zero skips). The same groups pass 3/3 on pinned main. Source/parent/macro/notice checks and conventions pass. All 34 recursive provider trees / 31,551 tracked blobs verify before and after the gate; QuickJS test262 is excluded as declared update=none test data.Shared main blocker:
public_headersfails on this head and pinned main for the same five missingWKSecurityOrigindeclarations. PR #16010 restores them separately; a maintainer needs to merge that fix and rerun required checks. This math branch does not contain the unrelated WebKit patch. Header audits and all required CI are not claimed green.The older Windows compile failure in
DepthSurface.cppwas a shared main API mismatch, fixed upstream by merged PR #15855, already included in this head. Its own hosted Windows compile job passed; this is not a fresh Windows qualification of this math head.Immutable source/audit/log/JUnit/hash and exact-lease push evidence, SHA-256
ef9e085442553c0fce1a4a6ce15781e4e890dc001a3424e1ef972f9b769f3065(download and member hashes verified). Earlier dated platform/negative/reference reports retain their original source pins. No new Windows, console/SDK-module, GPU/title, exhaustive or performance result. AI-assisted: yes, Codex Sol6.1 medium.All earlier qualification text below is historical and retains its recorded source/platform pins, including earlier linear/no-merge descriptions.
Current-main refresh — 2026-11-04. Head
7e8cf24820b56f83726fc3901e9177f0bb405c14merges main9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5cwhile retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic.Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently.
guest_math,guest_math_exact,guest_dinkumware_internalseach pass three consecutive runs (9 passes, zero skips). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins.Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe, SHA-256
97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845(download verified). AI-assisted: yes (Codex).Current-main integration — 2026-11-03. Head
1209717011eca23002108b7b612bff7eca85867eincludes main4f41f4c375f5abb487dbd184fbc150f31994d762and retains the prior public history and attribution/licence notices. Main’s newer math implementations and fixtures remain alongside this topic.Linux x86-64 Release, GCC 16.2.1, Ninja, BUILD_TESTING=ON: rebuilt actual libc and math executables.
guest_math,guest_math_exact, andguest_dinkumware_internalseach pass 3/3 (9 passes, zero skips);public_headersand conventions pass. The same three groups pass 3/3 plus headers on pinned main. All 34 recursive dependency trees and 31,551 tracked blobs verify with zero errors; the update=none QuickJS test262 corpus is excluded from these library inputs. Whitespace check passes.Source/parent/gitlink proofs, exact library/test hashes, raw logs/JUnit, and head-leased push receipts: qualification archive, SHA-256
e6a50522bc28e30871fdc2c12a88d2537515914239e8166f6237f48895126a06(download verified). Older platform/reference reports retain their original pins; no new Windows/macOS, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).Earlier dated qualifications below retain their recorded source/platform pins.
Current-main integration (2026-11-02):
9eb1ee9522c464c8f32d39096d21cf9c8bf9b016includes maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8and retains the existing public commits. Conflicts preserve main’s math implementations, regression checks and debt entries alongside this topic. Linux x86-64 Release, GCC 16.2.1: rebuilt libc and the three math executables;guest_math,guest_math_exactandguest_dinkumware_internalseach pass three times (9 passes, zero skips), andpublic_headerspasses. The same baseline groups pass on main; conventions and whitespace pass. Source and dependency blobs, executable/library hashes, raw logs and JUnit are retained. This refresh adds no new console, Windows, title, GPU or numerical-reference measurement. Qualification evidence, SHA-25622866bd2a060ba69cd4387d471605afe20ed644e3257174b2d1488635f8c9b52(download verified).Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head
d29ca14dca62846610c1a93209b2c463f14325acon 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
a67925f66764f51256b04d009ac27362789f8061on 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 refresh:
230d2ddce98099cfd89a189c0ef78c793980a0b9is refreshed onto maina5a780eaaa7f187fe8f5c7f2ef244f6a6dab2762, with prerequisite authorship retained and no merge commits. The original production and regression function bodies are preserved, along with main's log1p implementation, regression calls and current public declarations. The redundant source declaration of_Feraiseis removed; current canonical Api.hpp provides it.Fresh Linux x86-64 Release:
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass3/3 before and after the production-only main-Math negative control. The negative aborts as expected while exact-math/Dinkumware controls pass. Restored libc is byte-identical and sources clean. Conventions, whitespace and merge-tree checks pass.Exact-head logs, negative/restoration results and preservation proof (SHA-256
f107a42be1dabc4ef72ffddcc6274d35e65ebd40146c811214558b28d4952a90). No fresh original-module matrix, Windows/macOS/title/console or performance measurement is claimed by this refresh. Earlier reports below retain their measured source pins.Previous qualification (historical source pins)
Linux x86-64, GNU C++ 16.2.1, Release; exact head
778251f27a7be7363afdf495ea382641a78e90b6on dependency #10306 (99abd2604d53b7588b6386de012527c60ad6dcc7). This stack merges cleanly with mainb0f57be3c7.guest_mathandguest_dinkumware_internals: 3/3 each. Control:guest_mathaborts at the namedexpm1 overflowcheck; Dinkumware passes 3/3.ba190e6f5d8a71d8bfa6428f037f23f532479e2efff1ccece32cabd0690b8733. No game/module binaries are included.Current Linux qualification (2026-10-28)
Rebased onto
main2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 at8b6da33ff5518d4ee7f1620a5d1aca1e280fbffd(Arch Linux 7.2.9, AMD Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON).libc,guest_math_testsandguest_math_exact_testsrebuilt from this exact source.guest_mathandguest_math_exacteach passed three consecutive runs (6/6, no skips); the same two suites each passed three runs on the pinned main (6/6). Conventions and whitespace checks pass.The composition retains current main’s
1 + (x - e)scaling association alongside this topic’s overflow fix; both sets of regression checks remain.Exact source pins, preservation proofs, dependency checks, build logs and JUnit, SHA-256
1176269c9e6948b5252a5db9e660978d7f978fb2d9f4ed6c68bc050b10b5ae68. This is focused Linux CPU qualification; earlier Windows/title/reference measurements retain their original pins. No new title or performance result is claimed.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)1e20650e8458; present in audited main3fea2a937ba)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:15:57Z.
Review: APPROVED
Reviewed exact head 778251f27a7be7363afdf495ea382641a78e90b6. The finite-positive-overflow branch calls the guest floating-point error helper, which sets ERANGE and raises overflow plus inexact in x87 and MXCSR, then returns positive infinity. The wrapper preserves errno for non-finite inputs, and the tests cover threshold neighbors, rounding/DAZ/FTZ modes, seeded sticky flags, control state, and positive infinity. The supplied two-module integration matrix and hosted relinker checks are strong evidence for the stated scope. Physical-console, SDK, Windows/macOS, unmasked-trap, and game behavior remain explicitly untested; I did not independently rerun the Linux artifact.