fix(libc): preserve log1p reduction rounding #10546
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10546"
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-24T09:20:53Z.
What
Stacked follow-up to #10314. For
log1p(0x3fefffffffffffff)with upward rounding, the port returns0x3fe62e42fefa39ef; two supplied titles’ bundled libraries return0x3fe62e42fefa39f0.Form the positive-exponent range-reduction correction as
1 + (x - u)instead of1 - (u - x). The mathematical value agrees, but rounding the inner subtraction in the opposite direction changes the correction. This is one generic expression change, with a 48-call regression covering four rounding modes, four DAZ/FTZ combinations and three sticky-flag seeds; no input-specific production branch.Only the reduction association and its regression are new relative to refreshed parent
185098a39d9179907e11d15fa9a58b27e6aac306. This branch retains #10314’s implementation and history; #10314 has since merged into main. #10512 independently fixes the parent’s pole/domain exception behavior and is not included or required here. Both follow-ups should be retained when integrating the parent. #10315 also contains the same parent for its separate atanh work; it does not supply this correction. Shared GuestMath/debt insertion overlaps with other math topics require preserving their cases after whichever lands first. No unrelated topic is a dependency.Tested
Current-main integration — 2026-11-09 UTC. Head
6b7c1426b7f594503e1979e667b8b2c52ecb338apreserves public heade870883c659f5874cdd0eb824ee4ed196f4f7306and integrates pinned main7259cce11195f360698772da8c0b3af756bf7c8f. Conflict resolution retains both the topic and main's newer source/test/debt changes; maintainer commits and attribution remain intact.Linux x86-64, GCC 16.2.1, Ninja Release: actual libc/libkernel and focused fixture owners rebuilt. 12/12 CPU executions pass, zero skips (4 groups × three repetitions):
guest_math,guest_math_elementary,guest_math_exact,guest_dinkumware_internals.public_headers, conventions and whitespace checks pass. The matching plain-main control passed 102 selected CPU executions and its header audit. CPU fixtures execute unpatched production libraries; this is not a full SDK or patched-title runtime qualification.No new Windows/macOS, console, GPU, title or performance result is claimed. Source checks preserve the existing production topic; historical reports below retain their original pins.
Build/test logs, exact heads, source/ancestry checks and provider pins, SHA-256
52727be6594b9c15bf9a5535fef374b985e9526aabe5f3ef5cf5857dfeeb1a0d. The public archive and all 178 manifest files were download/hash verified.Latest integration (2026-11-05): head
c1decc6bdbe50fe4cf461252e953e9313ec8405e, 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
c2b06b93aa8e7afd0ba18d3e6efe28eabdf3c404includes 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
c339b78f59c59dec8588f51ed8f66b633b6230c7merges 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
8ea47fedc8a0fb252480bf9c7af76d5265684d9aincludes 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):
59a2d4e415ec29bc4f37af9e2ed83a46b623c96fincludes 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).Current-main conflict refresh, 2026-10-27 UTC: exact head
ffec55dd7c891fe641fd86ee16da69e398763ac4on 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.Refreshed head
3e3758ce7a29959120b8915157137fdf63ce7e7c: two topic commits directly on current #10314185098a39d9179907e11d15fa9a58b27e6aac306, based on main6c7a3256f25d2ea56702d06a2283ecc27ff133b3. A local merge-tree check with main8b426927d7d91c137e6f4704acc860f060a2798ais clean. The original log1p implementation and regression function are preserved, with main’s public libc declarations retained. The entire production file differs from the immediate parent by the single original correction expression.Fresh Linux x86-64 Release: libc and all three math targets rebuilt;
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three repeats. Same final tests with the immediate parent’s Math.cpp fail atlog1p reduction: input=3fefffffffffffff mode=2; exact-math and Dinkumware controls pass. Restored candidate passes all four groups three times and restores a byte-identical libc. Conventions/whitespace pass. No original-library matrix, Windows, whole-title or performance comparison was repeated.Fresh exact-head logs, negative/restoration checks, source proof and patch, SHA-256
99bb969b2e692880d5e3356e3bfdb8b8b42da580184ce215314bc265756d256b.Earlier qualification (historical source pins)
Arch Linux 7.2.9, GCC 16.2.1, Ryzen 9 7950X, Linux x86-64 masked floating-point exceptions.
832e925592built the actual libc and the math/Dinkumware test executables;guest_math,guest_math_exactandguest_dinkumware_internalspass (3/3).9a9156e541, with production unchanged from #10314, failsguest_mathspecifically atlog1p reduction:for the upward-rounding case. Dinkumware passes. The initial CTest selection also listed an unbuiltguest_math_exact; it was then built and passes on the final candidate. This missing executable is retained in the evidence, not counted as a numeric failure.19cb822f84; this is a mergeability check, not a fresh build of that main integration. PR overlap checked; required parent and independently overlapping follow-ups are identified above.Source patch, regression/probe, raw observations, exact identities and complete test logs, SHA-256
6e2b0f3baec6108f421621633d6ce78e43019c9069ec728dec05ad71955251f0.The fresh matrix is scoped to finite nonnegative arguments and is not exhaustive. The regression preserves both exception banks and errno. Other arguments retain the parent implementation, including its separate pole/domain gaps tracked by #10512. Windows, unmasked traps, physical consoles, games and FPS were not tested or claimed.
Current Linux qualification (2026-10-28)
Rebased onto
main2227f1366188cda5699dd20e2e756a18006a5d4b. Linux CPU validation on 2026-10-28 atac22f8e53ca3aa184d23c37b4498795915bce972(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.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)63a863d3b07f; present in audited main3fea2a937ba)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T09:38:50Z.
Review: APPROVED
Reviewed head
832e9255929fbfad76fda9fc0c99cdf135715ada. The production change is limited to the positive-exponent reduction correction in the FreeBSD-derivedlog1ppath; the alternate association is consistent with the reference algorithm and the target-binary evidence described in the PR. The regression exercises all four rounding modes, DAZ/FTZ combinations, seeded sticky flags, and the input that exposes the mismatch. I checked the full diff and the PR’s hosted checks; no blocking issue found. Approval is based on the scoped Linux CPU evidence and does not imply a console or Windows run.