Repository navigation
feat(libc): implement C99 numeric helpers - #2280
obojeoboje wants to merge 1 commit into
Conversation
|
Same as #2271: closing until a title is shown to reach these on main. |
Harvested from upstream (closed unmerged); library completion 2886/3260 -> 2904/3278. Additive conflicts resolved by keeping both sides: core/libs/prx/libc/CMakeLists.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011krDVCnnMQPaEFEqCDnKmA
|
@obojeoboje
With Since functions go in when a title reaches them, a resubmission would carry the |
Additional fminf validation target (2026-10-11, e22af77)Controlled PPSA99902 launches with validated unlocked-I/O and localeconv prerequisites now reproduce missing fminf/uVRcM2yFdP4 before guest entry in10/10 runs. Exact procedure, hashes, limits and comparison candidates. This PR bdf94e0 and #1770 c5107d5 are identified alternatives; neither implementation has been tested by us yet. FP signed-zero/NaN/exception validation and another title replay are next. No new PR; AI-assisted investigation: Codex. Independent original Linux fixture and min/max validation (2026-10-11, bdf94e0)I fetched and Git-blob-verified the original NumericHelpers.cpp and full GuestNumericHelpers.cpp at this PR's bdf94e0 head. Native standalone Ubuntu24.04 WSL/GCC13.3/glibc2.39, -O2 -frounding-math: the complete original fixture passes5/5. The original four min/max functions additionally pass18,432 source-checked bit-result/FP-flag/rounding cases on each of5 runs. This is not a full Linux AnyPS5 system-runtime/GPU build; the broader20 exports are covered only by your original fixture, not by the min/max matrix. The matrix matches separately compiled unmodified FreeBSD11.4 d1060029 function bodies (build adapters disclosed), and demonstrates Linux glibc divergences in #1770's host wrappers for signed zero and signaling NaNs; its default Windows build passes the same matrix. Exact counts, examples, provenance and limits. Your explicit IsNan/Extremum logic has been carried unchanged for the four focused min/max exports into current maina73 Math/GuestMath; relevant Windows and Linux probes pass, six mutants caught. Full build and PPSA99902 replay still pending. Other parts of this24-function PR have not been integrated or tested on Windows by us. Credit to this original PR. No new PR; AI-assisted tests/adaptation/report: Codex. No PS5 console-equivalence claim. Original Windows fixture and focused fork validation (2026-10-11, a73)Additional validation: the complete original bdf94e0 GuestNumericHelpers fixture, linked to its Git-blob-verified original production file, passes five native standalone Windows runs using WinLibs GCC15.2 r7, The focused four-function adaptation is on our fork59c6d5e, preserving your helper logic. Full Windows build/all122 libraries pass; full suite823 tests:810 pass/5 skip/8 fail, and math+locale integration811/5/7. Relevant tests/native minmax probes pass repeatedly. Failure controls and the newer-runtime title limitation: both before/after title profiles stop earlier at missing sceKernelGetCpuTemperature, so no minmax startup improvement is claimed yet. No new PR. Credit to this PR; AI-assisted tests/adaptation/report: Codex. Controlled title milestone after prerequisite restoration (2026-10-11)Fork experimental integration5cd5ea carries the focused four min/max exports, locale and validated kernel prerequisites onto maina73. The no-minmax libc control stops at missing fminf; replacing only libc in the same122-library profile reaches guest entry 5/5, then the independently retraced0x1a color-target guard tracked by #2970. Full control hashes, exact counts, source/termination limits and final812/824 full-suite result. No full integration of the other20 exports, console equivalence or gameplay claim; no new PR. Your explicit selection logic remains credited in focused59c6d5e. AI-assisted report: Codex. |
Conflicts: GuestMath.cpp kept both new checks; ceilf/truncf now only in Math.cpp as on main (our NumericHelpers.cpp copies came from boykopovar#2280, which main never merged).
What
Add 24 missing C99 numeric exports to libc in a separate translation unit:
sqrtf,fabsf,ceilf,truncf,nearbyint.remquo,remquof,copysign,copysignf.nan,nanf,nanl.nextafter,nexttoward,nexttowardf.fdim,fdimf,fmax,fmaxf,fmin,fminf,fmaf.scalbln,scalblnf.Min/max implement FreeBSD's signed-zero ordering and NaN handling directly, including no new exceptions when selecting the numeric operand against a signaling NaN. Bit classification avoids arithmetic on the NaN operand.
nexttowardretains the extended-precision target rather than narrowing it to the result type. Neighbor operations normalize missing MinGW overflow/underflow flags andERANGEat representation boundaries.Guest
longexponents are 64-bit on Windows too.scalblnbounds the exponent before calling the native int-exponent operation; the bounds exceed the full float/double exponent range. Compile only the new implementation and fixture with-frounding-math.Contracts and signatures follow FreeBSD math(3), fmax(3), and scalbn(3). All 24 names occur in the shadPS4 aerolib table.
Checked current open PR descriptions, existing exports across libraries, and relevant libc patches in #2193, #2192 and #2167. #2192 implements
nextafterf; this branch addsnextafterandnexttoward*. This branch is independent of #2235 and #2271 and excludes their exports. Shared CMake insertion points may need both independent registrations preserved when rebasing.The progress scanner changes from 2578/3044 (84.69%) to 2602/3068 (84.81%). Both counts grow because these are newly declared exports.
Tested
libstarget passed.guest_video_out_wqhd_detection_no_vulkan), zero failures; 41.04 seconds total.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)