fix(libc): leave errno alone for subnormal strtod results #8379
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8379"
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 hypermoist on 2026-10-20T11:48:44Z.
What
The console's
strtof(0x731a0),strtod(0x65860) andstrtold(0x749b0) from the decryptedlibSceLibcInternal.sprxwere run on the host through a loader. They setERANGEonly when the result underflows to zero, and leaveerrnountouched for a non-zero subnormal:1e-400x1.16c3p-133, no error1e-46ERANGE1e-310ERANGE0x0.012688b70e62bp-1022, no error1e-330ERANGEERANGE1e-4940ERANGEERANGE0x0.000000663278e62p-16385, no error1e-4960ERANGEERANGEERANGEThe shared
ParseFloatpasses through the host'sstrtod,strtoforstrtold, which (glibc) setERANGEfor every subnormal result too. It now restores the caller'serrnowhen the host reportsERANGEfor a result that is non-zero and below the type's smallest normal value. Overflow and underflow to zero still setERANGE.wcstodand the other callers ofParseFloatinherit the change.Tested
Linux (CachyOS, GCC, Release).
guest_math_testshas a newCheckFloatUnderflowErrno:strtod,strtofandstrtoldresults keep a preseterrno;ERANGE;The check aborts without the fix and passes with it.
guest_string_testsstill passes.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)🤖 Generated with Claude Code
https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T12:11:38Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libc/src/Strings.cppcore/libs/tests/GuestMath.cppcore/libs/tests/GuestMath.cppcore/libs/prx/libc/src/Strings.cppcore/libs/prx/libc/src/Strings.cppImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T12:54:18Z.
Windows data point for
b455c751bmerged ontomain44e3389c8(clean,git merge-treerc 0): Windows 10.0.19045, MinGW-w64 GCC 15.2.0, Release.ctest -N -R '^guest_math$'lists exactly that one test;ctest --no-tests=error -R '^guest_math$'was run three times per tree.core/libs/prx/libc/src/Strings.cpprestored tomain(the newCheckFloatUnderflowErrnokept): fails 3 of 3, exit code0xc0000409(the test process aborts).Not tested: other platforms, a title run.
AI-assisted (Claude Code).