fix(libc): follow msun for asinhf #10002
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10002"
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 MarcZX10 on 2026-10-23T03:43:02Z.
What
asinhfcurrently forwards to the Windows host library. The #9707 survey reports 1,871,981 and 1,870,953 result-bit differences from the two bundledlibc.prxbuilds over 20 million inputs. This ports FreeBSD msun'ss_asinhf.crange handling and reuses the existinglog1pfpath for the small and moderate range.The survey establishes host-versus-title differences, not the exact implementation used by every console library. The exact system
libSceLibcInternalbehavior and FMA-contractedlibc.prxresults remain unverified, as recorded in the debt entry.Tested
Math.cppandGuestMath.cpp.std::asinhrounded to float (maximum difference 1 ULP).GuestMath.cppcompiled.guest_mathtarget was not run.check_conventions.py,pr_overlap.pyandgit diff --checkpassed.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 harisibrar1 on 2026-10-24T12:30:01Z.
Review: COMMENTED
Checked against main
87666fc5d6and FreeBSD msuns_asinhf.cat release/9.0.0, 10.0.0, 11.4.0 and 12.0.0 (all identical to the pinned 5aa554c7 copy):0x31800000,0x4d800000,0x40000000),ln2,hugeand the three expressions match msun line by line, and the|x| <= 2branch correctly goes through the existing msunlog1pfpath (AtanhfLog1p).logfthroughstd::log(float), while msun calls__ieee754_logf. Main already has msun'se_logf.caslogf_nid_postfix(Math.cpp:1025), which the debt entry records as bit-identical to the titles'libc.prxfor all 2^32 arguments. Could those two calls use it, with a declaration as inDinkumwareInternals.cpp:23? In a Python float32 emulation of the msun chain, msun'slogfand a correctly roundedlogfgive differentasinhfresults on about 1.4% of inputs in (2, 2^28] (e.g.0x419999e4:0x406984fevs0x406984ff) and about 0.2% above 2^28 (e.g.0x55c5129d:0x41fcfc3fvs0x41fcfc3e). I couldn't run UCRT'slogf, so I can't say which side it lands on at those points, but using the port removes the question.Near(..., 1e-6)checks wouldn't notice that difference; one or two exact-bit checks in those ranges would pin it.git merge-treeagainst current main shows a conflict incore/libs/tests/GuestMath.cppwith the merged acoshf change (#10003). Keeping both check functions and both calls resolves it.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.