Repository navigation
Conversation
|
The implementation change is narrowly scoped and the Windows negative-control/title comparisons are useful. One small test-coverage gap: |
|
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.
|
|
Good catch, thanks:
AI-assisted: yes (Claude Code). |
|
Linux run at this PR's exact head Arch Linux, kernel 7.2.9, Ryzen 9 7950X, g++ (GCC) 16.2.1 20260810, glibc 2.44, x86-64. Release,
|
|
@oneandonlydean The current macOS relinker job for this head builds successfully, then reports 377/378 CTests passing. Its only failure is the shared Python This PR changes only the libc rounding implementation and AI-assisted: yes. |
BunnyFl
left a comment
There was a problem hiding this comment.
Approving head 6829885e23. I read the whole diff and ran firmware 13.42's floor and floorf: the decrypted system libSceLibcInternal.sprx's exports, natively on a PC (not a console), in each of the four rounding modes. The module's rint(±0.5) changes with the mode in the same run, so the mode reaches it. Three identical runs.
- In every mode,
floorof 0, 0.1, 0.5 and0x1.8p-1030, andfloorfof 0, 0.1, 0.5,denorm_min,0x1p-130fandFLT_MIN, return+0. floor(-0.5)andfloorf(-0.5f)return -1;-0keeps its sign; ±1.5 give 1 and -2.
These are the values the new CheckRoundingModes rows require, so the system module agrees with them. The one failed CI job is the macOS clang++ relinker run, where only performance_compare (tools/tests/test_performance_compare.py, 20 s timeout) timed out; this PR doesn't touch it.
… rounding down Math.cpp is built without -frounding-math, so GCC inlines std::floor as an add-and-subtract-2^52 sequence that is only exact when rounding to nearest. With FE_DOWNWARD it returned -0 for +0, 0.1, 0.5 and positive subnormals, where titles' libc.prx returns +0. Define floor and floorf in MathExact.cpp, which is built with -frounding-math for this reason, next to rint and rintf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… mode The floorf checks converted the double inputs to float, which made 0x1.8p-1030 a zero. Check the float denormal minimum, 0x1p-130f and FLT_MIN directly, and that floorf(-0.0f) keeps its sign. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6829885 to
b6fc3a3
Compare
|
Refreshed against main Linux qualification at Evidence: immutable Linux qualification bundle. Its SHA-256 is AI-assisted: yes. |
|
A Windows run with GCC 16: Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release,
AI-assisted: yes (Claude Code) |
What
With
FE_DOWNWARD,floorandfloorfreturned-0for+0,0.1,0.5and positive subnormals. The correct result, and what titles'libc.prxreturns, is+0.Math.cppis built without-frounding-math. Without it, GCC inlinesstd::flooras an add-and-subtract-2^52 sequence that is only exact when rounding to nearest. Rounding down,x - x-style steps produce-0.MathExact.cppis already built with-frounding-math(core/libs/prx/libc/CMakeLists.txt) for this reason, and itsrint/rintfmatch the titles in every mode.floorandfloorfmove there, next to them, unchanged. I didn't add-frounding-mathto all ofMath.cpp, since that would change code generation for every other port in it.GuestMathExact.cpp'sCheckRoundingModesnow checks, in each of the four rounding modes:floorandfloorfof0.0,0.1,0.5and0x1.8p-1030are+0;floor(-0.5)is-1;floor(-0.0)andfloorf(-0.0f)keep their signs;floorfof representable positive float subnormals (denorm_min()and0x1p-130f) andFLT_MINis+0.Tested
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON, onmaincc672fdfc6.guest_math_exactandguest_mathpass in each of 3 runs.Negative control: with
main'sMath.cppandMathExact.cppand this test,guest_math_exactfails.The cause alone: the same
std::floorbuilt with-O2returns-0for0.5,+0,0.1and0x1.8p-1030underFE_DOWNWARD. With-O2 -frounding-mathit returns+0.Against titles' own
libc.prx: I loaded PPSA07923's and PPSA05916's bundledlibc.prxnatively and calledfloor,floorf,ceil,ceilf,trunc,truncf,round,roundf,rint,rintf,nearbyintandnearbyintfby NID, side by side with this build. The inputs were 27 values (halves, ±0, ±2^52 ± 0.5, 2^53, subnormals, ±1e300, ±inf, NaN) in all four rounding modes, comparing result bits and raisedFE_INEXACT/FE_INVALID. Both titles gave the same results:floor,floorf: 5 wrong results each onmain(allFE_DOWNWARD), 0 with this change;ceil,ceilf,trunc,truncf,rint,rintf: 0 before and after.The remaining differences are flags only and outside this PR:
round/roundfdon't raiseFE_INEXACTfor large integral inputs where the titles do (12 each);nearbyintfamily doesn't raise it at all (fix(libc): raise inexact for nearbyintf #12178 coversnearbyintf).Linux follow-up:
guest_math_exactandguest_mathpass three runs each at exact head6829885e23; environment and results. macOS remains untested.Current Linux qualification — 2026-10-29
Refreshed against main
5454cd2e455994d992aca39335ce60507eeda1eb.Linux qualification at
b6fc3a313a9c7e7a48ace600d0a7fff7beb1b4b6(Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON):guest_math,guest_math_exact,guest_dinkumware_internalseach pass three consecutive runs (9/9, no skips). Thepublic_headersaudit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main.Evidence: immutable Linux qualification bundle. Its SHA-256 is
53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins.AI-assisted: yes (Codex).
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