Skip to content

feat(libc): export the Dinkumware float characteristic tables - #8576

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
priyanshrv-netizen:feat/libc-float-characteristics
Oct 21, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
priyanshrv-netizen:feat/libc-float-characteristics

Conversation

@priyanshrv-netizen

Copy link
Copy Markdown
Contributor

What

Exports _Flt (+SeQg8c1WC0), _Dbl (e+hi-tOrDZU) and _Ldbl (43u-nm1hQc8), the tables behind Dinkumware's float.h macros, which the system libc.prx (build J03093718) exports and no source in core/libs/prx or open pull request defines yet.

Each table is 80 bytes, read from that module's data: six ints (digits, mantissa digits, maximum and minimum decimal exponent, maximum and minimum binary exponent), 8 bytes of zero padding, then epsilon, maximum and minimum as 16-byte _Dconst values:

Table Integers Epsilon Maximum Minimum
_Flt 6, 24, 38, 128, -37, -125 0x34000000 0x7f7fffff 0x00800000
_Dbl 15, 53, 308, 1024, -307, -1021 0x3cb0000000000000 0x7fefffffffffffff 0x0010000000000000
_Ldbl 18, 64, 4932, 16384, -4931, -16381 2^-63 x87 maximum x87 minimum normal

_Ldbl describes the x87 80-bit format, as Sony's long double is. They go in core/libs/prx/libc/src/Math.cpp as DinkumwareFloatCharacteristics, in a spot away from the lines #6085 and #8570 change.

CheckDinkumwareFloatCharacteristics in core/libs/tests/GuestMath.cpp checks the layout, the integers against <cfloat> (the x87 values for _Ldbl), the three values against std::numeric_limits with their unused bytes zero, and the zero padding.

Tested

Windows 10, MSYS2 MinGW-w64 GCC 15.2.0 (mingw64, not the WinLibs UCRT toolchain from BUILD.md). I did not configure the full CMake build. Math.cpp builds with -Wall -Wextra -Werror -fno-asynchronous-unwind-tables, and GuestMath.cpp compiles without warnings. CheckDinkumwareFloatCharacteristics (copied unchanged from GuestMath.cpp) compiled against this Math.cpp passes; against main's Math.cpp it fails to link on all three symbols.

Against the console's own data: I mapped that libc.prx's segments into memory, applied its relocations and compared the three tables with the objects the module exports under the same NIDs. All 80 bytes are identical for each.

tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch feat/libc-float-characteristics reports no overlap. It could not compare #6044, #6158 and #7201 (each conflicts with main); I checked them by hand: #6044 only renames GuestMath.cpp, and #6158 and #7201 change other lines of these files and add none of these exports. Not tested on Linux; no title was run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

Add _Flt, _Dbl and _Ldbl, the 80-byte tables behind Dinkumware's
float.h macros, with the values the console's libc.prx exports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestMath.cpp
PR 6158 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 6879 core/libs/prx/libc/src/Math.cpp
PR 7201 core/libs/prx/libc/src/Math.cpp
PR 8449 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp
PR 8658 core/libs/prx/libc/src/Math.cpp
core/libs/tests/GuestMath.cpp

@github-actions github-actions Bot added the libc label Oct 20, 2026
@oneandonlydean
oneandonlydean merged commit 1ffe979 into boykopovar:main Oct 21, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants