fix(libc): format %La like titles' libc.prx does #9958
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9958"
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 JJenkx on 2026-10-23T00:07:16Z.
What
A
long double%Laor%LAstill went to the host after #9699, as that PR records. MinGW's printf on Windows writes the 64-bit significand with its explicit integer bit as the leading hexadecimal digit. Thelibc.prxthat titles ship normalises along doublethe way it does adouble: a leading 1, then the other 63 bits as 16 hexadecimal digits with the last bit zero. Console vsmainon Windows (both columns measured):main%Laof 0.1L0x1.999999999999999ap-40xc.ccccccccccccccdp-7%Laof 1.0L0x1p+00x8p-3%.0Laof 1.5L0x2p+00xcp-3%.15Laof0x1.fffffffffffffffep0L0x2.000000000000000p+00xf.fffffffffffffffp-3%Laof0x1p-16445L(smallest subnormal)0x1p-164450x0.000000000000001p-16385%010Laof 1.5L0x001.8p+00x0000cp-3A shorter precision rounds half up on the dropped digits. A carry stays in the leading digit, as #9699 does for
double.This PR splits #9699's
HexFloatintoHexDigits, which holds the digit, rounding, flag and width code, and two front ends. Thedoubleone is unchanged in behaviour. The newlong doubleone normalises withfrexp. Finitelong double%a/%Anow use it in the narrow and wide families, next to #9916'sDecimalFloat. Infinities and NaN keep their current paths.Tested
Latest review refresh:
afa58432f356bd5d481cc6fa99b9b736e5a80dba, the sole authored topic on main035ac96edd092773a5ba0131453de80084a23533after #9927 merged. Linux Release: formatting, wide formatting and variadic groups each pass three runs before and after restoration (9 passes per arm). Restoring only main production with the PR tests retained fails both expected%Laregressions; the variadic control passes. Conventions, whitespace and main sync pass; the authored patch is unchanged. Exact-head evidence, SHA-2569cba098a67264de658442a500905e4196e20f50d666c132bc7eaeb308061e0dd. Earlier reports below retain their original source pins and platform limits.Refreshed exact head, 2026-10-25:
98992248b272e3729a4aaa76118ea2298ab1c80a. One own final commit directly on refreshed #9927 at2def057898f2d0d857bed1579e14b6930adf4cd2, with main49d1f9b07ec7f6f989ace1c504bbe9dd6748dcbbunderneath. Its original final patch and debt explanation are preserved. No merge commits or duplicated merged prerequisites. All added/removed line multisets for this topic's code, tests and debt match the former public patch. Conventions and whitespace pass. Both stack heads merge cleanly with newer mainb76f08cf33ea280d6155f16a84c1555701c3b2af, which changes only libSceNet export/tests/debt since the tested base; that is a merge preview, not another build.Fresh Linux GCC 16.2.1 Release: rebuilt libc and all 12 selected CPU test executables. Exact main, candidate and restored candidate each pass 12 groups × 3 repetitions (36 passes per arm), zero skips. This includes complete
guest_formatting,guest_wide_formattingandguest_stdio_variadicexecutables, plus wide strings/conversion/stream scanning, scan counts, strings, allocating strings, allocator failures, multibyte locale and character checks.Restoring only #9927's
WindowsFormatting.hppandFormattingWide.cppwhile retaining the leaf tests fails both formatting groups: narrow%Laof0.1Lgives the host's explicit-integer-bit form, and the wide long-double hexadecimal check fails. Those parent-production controls fail both expected groups. Restoring this exact head passes all 36 executions again and reproduces identical hashes for libc and all 12 tested executables.Both pinned heads, full source-preservation checks, patches, build/test logs, parent controls and restoration hashes. SHA-256:
7da9766761e33dbc0bd05a7462cda802cb6b2d9a096516324133055079f9e151; downloaded copy verified.These are CPU regression results, not a fresh Windows run, converted title-libc differential, physical-console measurement, game/performance run or full-suite build. Earlier evidence below retains its original revisions and platforms.
Historical pinned validation
Earlier Linux refresh:
252b1593b85d3c1fdef3822c795bce98666b8e6don main637220db112a3daf4960984290a82fcf65ba7061. The stack is rebuilt linearly in the order #9699 → #9916 → #9927 → #9958 → #10379, with no merge commits or duplicated prerequisite commits. This PR adds one long-double hexadecimal commit. Fresh Release libc/fixture build andguest_formatting,guest_wide_formatting,guest_stdio_variadicpass (3/3) on this exact head; conventions against the tested main and whitespace checks pass. Final-stack conventions against origin/main have zero errors (six inherited debt-length warnings). All five heads also merge cleanly with newer mainc8d34aa8f4d8058d57169cc1e423ba6db00faaf0; that merge preview is not an additional runtime test. The original double and long-double hexadecimal helper bodies are preserved byte for byte, including their output-length bounds. All five pinned heads, patches, checks and control logs (SHA-2569cda806ab2a54a4a0ce012517eafb7db0441ab2665d2e49884c3d1fc5b9e0c8a). No fresh Windows, title-library comparison, physical-console, game or performance result is claimed; Windows testing remains paused. The requested fresh Windows validation on #9699 is still outstanding.Historical validation on previous public head
89f761f7aba4a50a874b43893ee83f22636f33ccis retained below with its original scope; references there to ‘exact head’ refer to that historical run.Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON. Head 8283798a60, on #9927's head 72e9e54e15 (main895f47f4ee).Differential run: a scratch loader runs a title's decrypted
libc.prxnatively and compares itssnprintfwith this build'ssnprintf_nid_postfix.[%La],[%LA],[%.3La],[%.0La],[%#.0La],[%20La],[%-+20.2La]and[%.20La], each on eleven values: 0.1, 1, 1.5, -2, the smallest subnormal and normal, the largest finite, +0, -0, π and 1e-4000.long doublevalues in%Laand%.0La…%.19La.main72 of the 88 fixed cases and all 100,000 random ones differ. With this change none differ, on the copies bundled with PPSA07923, PPSA05916 and PPSA13934.guest_formatting: the newCheckLongDoubleHexFloathas 13 console results, covering ties and carries,#,+,-and0, ±0, the subnormal and largest values, and a long precision.guest_wide_formattinggains aswprintf%Lacheck. The libc formatting, scanning, stream, wide-character and string tests (34) pass in three runs out of three. With #9927'sWindowsFormatting.hppandFormattingWide.cppand these tests,guest_formattingandguest_wide_formattingfail.python tools/check_conventions.py --base origin/mainandgit diff --checkpass.Not tested on a physical console.
Linux (reviewer run): MarcZX10 ran a focused Linux check in an existing configured Release build with GCC 12:
guest_formattingandguest_wide_formattingpassed 2/2 with this PR head's formatting and test sources. That reused an older configured tree with the PR's sources overlaid, so it is a focused Linux run, not a clean CI build.Linux (exact PR commit):
8283798a603b845204cb5efe95c85344ce1be56ain a fresh detached worktree with initialized submodules and a newly configured Ninja Release build (BUILD_TESTING=ON,ANYPS5_RELINKER_CLI=ON,ANYPS5_ENABLE_SPIRV_TOOLS=OFF), GCC 16.2.1 20260810, glibc 2.44. Builtguest_formatting_testsandguest_wide_formatting_tests;ctest --test-dir <build> -R '^guest_(wide_)?formatting$' -V --no-tests=error --timeout 120passed 2/2 in each of three runs, with no skipped tests. This verifies the complete two focused executables at this PR commit; it is not a full product build, a new console differential run, or a test against latest main. No negative control was run in this Linux job.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)2def057898f2d0d857bed1579e14b6930adf4cd2)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:35:40Z.
Review: DISMISSED
The added exact-head Linux evidence resolves my earlier platform-coverage request: the fresh detached build reports both focused formatting executables passing 2/2 in each of three runs, in addition to the Windows title-libc differential and test results. Current hosted conventions, eligibility, intake, labels, relinker matrix, ASan, register-context, and write-watch checks pass; hosted full Linux/Windows product builds are skipped. Local current-main conventions, diff, and 171-script registration checks pass.
I cannot approve this stack as currently based:
tools/check_main_sync.py --base upstream/main --head refs/reviews/pr-9958reports 8 commits ahead /259 behind. This branch depends on #9927, which is itself still awaiting its current-main refresh, and #9927/#9916 affect the formatting implementation underneath this change. Please coordinate the stack refresh after those dependencies are integrated, retain this PR's own final commit and its debt explanation, then rerun the two focused tests and conventions on the refreshed exact head. This request is for the repository's current-main branch rule, not queue volume.