The wide printf family left NaN to the host, which dropped the sign of a
negative NaN but printed +nan with the + flag. The libc.prx that titles
ship prints a NaN in swprintf like an infinity, as its snprintf does:
-nan for a negative NaN, +nan or " nan" with the + and space flags, NAN
for the upper-case conversions, padded with spaces. The wide formatter now
does the same through its own helper; the narrow family is #10223's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A long double %La went to the host, which on Windows (MinGW) prints the
64-bit significand with its integer bit as the leading digit:
0xc.ccccccccccccccdp-7 for 0.1L. The libc.prx that titles ship
normalises it like a double, with a leading 1 and the remaining 63 bits
as 16 hexadecimal digits, 0x1.999999999999999ap-4, and rounds a shorter
precision half up with the carry kept in the leading digit. Share
HexFloat's digit and rounding code between double and long double and
use it for finite long double %a and %A in the narrow and wide families.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Console libSceLibcInternal exports Y9C9GeKyZ3A as a 136-byte STT_OBJECT;
titles that resolve the wide num_get vtable as data need a zeroed 17-slot
object matching the narrow num_get layout on console.
CallPersonality followed a jmp [rip+disp] import thunk by reading the bytes
at the personality address before checking it against the known
personalities, so an unmapped personality faulted instead of returning
_URC_FATAL_PHASE1_ERROR / _URC_FATAL_PHASE2_ERROR as it does on Linux. The
thunk and its slot are now read only when VirtualQuery reports them
committed and readable. exception_personality, which covers this, now runs
on Windows too.
tanh returned the host's tanh, whose last bit differs from the titles' copy
on Windows. The titles' copy is FreeBSD msun's s_tanh.c over msun's expm1,
and it sets no errno. tanh now computes that algorithm over this file's
Expm1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
trunc, ceil, floor and nearbyint and their float forms returned the
host's result, which on Windows passes a signalling NaN through
unchanged. The titles' copies follow FreeBSD msun, which returns x + x
for a NaN, so the NaN comes back quieted with its payload and sign; these
functions now do the same before calling the host for other arguments.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ctype functions threw std::invalid_argument for any value below EOF,
so a title passing a plain char with its high bit set, such as a UTF-8
byte, aborted. The libc.prx bundled with titles accepts -128 to -2: each
class function returns 0 for them, as for 128 to 255 in the C locale,
and toupper and tolower return them unchanged. Values outside -128 to
255 still throw.
Co-Authored-By: Claude Opus 5.5 <[email protected]>