feat(libc): implement sqrt and sqrtf #3233
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3233"
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 adriadam10 on 2026-10-11T02:45:00Z.
What
sqrt(MXRNWnosNlM) andsqrtf(Q+xU11-h0xQ), imported fromlibSceLibcInternal, aren't exported. Since #1529 binds those imports to the system libraries on Linux, and withfrexplin since #3221, PokeMMO Prospero now stops onsqrtat load onmain:mainaac0f1b81./app.elf: symbol lookup error: ./app.elf: undefined symbol: MXRNWnosNlM(sqrt)It imports
sqrtftoo, so both go in here.Both use the host's
std::sqrt. IEEE 754 requires square root to be correctly rounded, so the result is the exact one on every conforming host, the console included. That includes -0, infinity and NaN for negative arguments.Tested
Linux (CachyOS), GCC 16, Release.
guest_mathpasses. The new cases are compared bit for bit with values computed independently in Pythondecimal:sqrt(2)=0x3ff6a09e667f3bcdandsqrtf(2)=0x3fb504f3;sqrtof the smallest subnormal =0x1e60000000000000(2^-537);mainthe test doesn't link.sqrtthroughfloat, andsqrtfdropping the sign of -0.main's relinker and launched. It stops at load with the line above.tools/check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T02:45:21Z.
Progress report (
aac0f1b→660abec)📈 System libraries: 86.0% (+0.01%, +2 implemented functions)
✅ 2 implemented
sqrt_nid_postfixsqrtf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T02:53:57Z.
Merged: Linux CI is red only on
agc_unit_shadow, which main has failed since #2864 (reported in #3215). Windows passed, andguest_mathpassed on both.