215 Commits
Author SHA1 Message Date
Dean da6b0ea8dd Merge pull request #11884 from JJenkx/windows/libc-strtof-nan-payload
fix(libc): keep NaN payloads in strtof and wcstof as titles' libc.prx does
2026-10-28 20:11:27 +13:00
Dean 24795c0f56 Merge pull request #10529 from JJenkx/fix/libc-expm1-scaling-association
fix(libc): preserve expm1 rounding during exponent scaling
2026-10-28 17:49:49 +13:00
Dean 057de19313 Merge pull request #11556 from xXPBSXx/libm/sinh-msun
fix(libc): compute sinh with FreeBSD msun's algorithm
2026-10-28 13:03:47 +13:00
Dean 9f605c98d2 Merge pull request #10283 from JJenkx/windows/libc-cbrt-msun
fix(libc): compute cbrt with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-28 13:01:01 +13:00
Dean 46b9aa3768 Merge pull request #9648 from JJenkx/windows/libc-rand-console
fix(libc): follow the console's rand, srand and rand_r
2026-10-28 13:00:35 +13:00
JJenkxandClaude Opus 5.5 bece5871e2 fix(libc): keep NaN payloads in strtof and wcstof as titles' libc.prx does
strtof and wcstof returned the default quiet NaN for any NAN(...)
sequence. The libc.prx bundled with eleven titles reads the payload as
its strtod does, but into one 32-bit word: a blank after the first group
of digits ends it, the first 8 digits are kept and cut to 24 bits, the
result goes under the quiet bit with the sign, and a zero payload
becomes 1. HexNanPayload now takes the word count, two for double and
one for float, and the NaN table test checks the measured float bits
and end for all 64 inputs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 07:13:19 -04:00
JJenkx f89e32170c fix(libc): preserve expm1 scaling association under directed rounding 2026-10-27 06:20:52 -04:00
JJenkxandClaude Opus 5.5 8f39bcc549 Merge main into PR #10283
Conflicts with main's newer libc changes resolved without changing either
side: the debt list keeps each side's entry changes (per entry, deletions
included), GuestMath.cpp keeps both sides' test functions and calls, and
Math.cpp differs from main by exactly this branch's own changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 05:06:27 -04:00
Dean fd4a4ca3dc Merge pull request #11277 from AlexFigas/fix/libc-fpclassifyf-dinkumware-codes
fix(libc): return Dinkumware codes from __fpclassifyf
2026-10-27 21:22:30 +13:00
Dean d5f7d86ccc Merge pull request #11139 from JJenkx/fix/libc-modf-floating-environment
fix(libc): preserve modf decomposition and floating-point status
2026-10-27 21:20:33 +13:00
Dean d090e62841 Merge pull request #11074 from JJenkx/fix/libc-frexpf-floating-environment
fix(libc): preserve frexpf decomposition and exception behavior
2026-10-27 21:18:34 +13:00
Dean 2aacb376ee Merge pull request #10346 from JJenkx/windows/libc-logb-msun
fix(libc): compute logb and logbf with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-27 21:09:12 +13:00
Dean 5a36b2df1e Merge pull request #9850 from JJenkx/windows/libc-powf-msun
fix(libc): compute powf like the libc.prx that titles ship
2026-10-27 21:07:00 +13:00
Dean 853b370f01 Merge pull request #9784 from JJenkx/windows/libc-atan2f-msun
fix(libc): compute atan2f with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-27 21:06:05 +13:00
Dean 619ac3c2b6 Merge pull request #10467 from MarcZX10/fix/libc-tgammaf-underflow-sign
fix(libc): preserve tgammaf underflow sign
2026-10-27 20:53:02 +13:00
xXPBSXxandClaude Sonnet 5.5 a7685595cd test(libc): check the errno sinh sets on overflow
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 08:00:05 +01:00
xXPBSXx fccdc6d687 Merge main (951e5963a4) into libm/sinh-msun 2026-10-27 07:58:16 +01:00
Dean 1eb876b63a Merge pull request #10907 from imellag/test/libc-math-standard-exception-flags
test(libc): compare the C exception flags in the scaled hyperbolic checks
2026-10-27 18:28:30 +13:00
Dean 1a13c2969f Merge pull request #9833 from MarcZX10/codex/libc-strtod-decimal-subnormal-erange
fix(libc): set ERANGE for decimal strtod subnormals
2026-10-27 18:21:37 +13:00
Dean 304bea47ca Merge pull request #9771 from JJenkx/windows/libc-asinf-msun
fix(libc): compute asinf with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-27 14:58:25 +13:00
JJenkxandClaude Opus 5.5 1add0a5859 fix(libc): follow the console's rand, srand and rand_r
rand and rand_r both used FreeBSD's do_rand (Park and Miller on
state % 0x7ffffffe + 1, minus one), so rand returned values up to
0x7ffffffd and rand(), rand_r() and every seeded sequence differed
from the console. The libc.prx that titles ship (the same code in the
copies of PPSA13934, PPSA07923 and PPSA05916, read from disassembly)
uses two different generators:

- rand steps a 64-bit state, initially 1, as
  state * 0x5851F42D4C957F2D + 1 and returns (state >> 32) & 0x3FFFFFFF,
  so its results stay at or below 0x3FFFFFFF. srand stores the seed
  zero-extended as that state.
- rand_r is the minimal standard generator, state * 16807 modulo
  2^31 - 1 on the signed 32-bit state (1 gives 16807, 282475249,
  1622650073), and a zero state becomes 0x2AE1B767.

guest_math now expects those results: the rand_r chain from 1, the
zero and 0x7FFFFFFF states, rand after srand(1), srand(0) and
srand(0xFFFFFFFF), and rand's range over 1000 calls. Its previous
checks expected FreeBSD's values and rand matching rand_r.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 20:22:30 -04:00
MarcZX10 bcd99084b4 test(libc): cover signed tgammaf underflow 2026-10-26 22:18:30 +00:00
xXPBSXxandClaude Sonnet 5.5 c78810a2de test(libc): cover the first sinh argument past ln(DBL_MAX)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-26 21:14:53 +01:00
xXPBSXxandClaude Sonnet 5.5 e1979dffde test(libc): cover sinh from 22 up to the overflow threshold
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-26 21:04:47 +01:00
xXPBSXxandClaude Sonnet 5.5 0567c826e7 test(libc): pin sinh bits below 22 to FreeBSD msun's results
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-26 20:01:35 +01:00
Adrià c9a6013f4d Merge pull request #10468 from JJenkx/fix/libc-nextafter-fenv
fix(libc): preserve nextafter exception flags and denormal modes
2026-10-26 19:50:43 +01:00
JJenkx c48ed84d47 fix(libc): preserve modf decomposition and floating-point status 2026-10-26 09:34:58 -04:00
Dean bf77a9e9cb Merge pull request #10742 from 00xDisaster/feat/libc-lcosh
feat(libc): implement _LCosh and _LSinh
2026-10-27 02:28:15 +13:00
JJenkx ef0afbb731 test(libc): make nextafter environment coverage portable 2026-10-26 08:24:29 -04:00
JJenkx f5f4f7fbf8 fix(libc): preserve nextafter floating-point environment behavior 2026-10-26 08:24:29 -04:00
Dean cbee224804 Merge pull request #10316 from JJenkx/windows/libc-tanh-msun
fix(libc): compute tanh with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-26 21:48:43 +13:00
Dean Galvin 42a75519e3 Merge branch 'main' into windows/libc-tanh-msun 2026-10-26 18:37:39 +13:00
Dean Galvin 7461106f53 Merge branch 'main' into fix/libc-acoshf-domain-fenv 2026-10-26 17:40:43 +13:00
JJenkxandClaude Opus 5.5 ca1b62a3bd fix(libc): compute tanh with FreeBSD msun's algorithm, as titles' libc.prx does
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]>
2026-10-25 22:26:16 -04:00
JJenkxandClaude Opus 5.5 f91f0450b5 fix(libc): quiet signalling NaNs in trunc, ceil, floor and nearbyint as titles' libc.prx does
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]>
2026-10-25 22:26:12 -04:00
JJenkxandClaude Opus 5.5 6d9fd5d1e7 fix(libc): store EDOM from asinf where titles' libc.prx does
asinf left errno unchanged for |x| > 1, the infinities and NaN, following
included, stores EDOM there and leaves it alone for |x| <= 1; asinf now
does the same, and the test expects it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 22:18:51 -04:00
JJenkxandClaude Opus 5.5 ebc8bcc106 fix(libc): compute asinf with FreeBSD msun's algorithm, as titles' libc.prx does
asinf returned the host asin, so its last bit depended on the host: on
Windows it differs from the libc.prx that titles ship on 5,413,834 of the
floats in (-1, 1). That libc.prx is msun's e_asinf.c, which gives the same
bits as PPSA07923's and PPSA05916's copies for all 2^32 arguments. errno
is still left unchanged for |x| > 1 and NaN.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 22:18:51 -04:00
JJenkxandClaude Opus 5.5 035d9c0821 fix(libc): compute cbrt with FreeBSD msun's algorithm, as titles' libc.prx does
cbrt returned the host's cbrt, whose last bit differs from the titles' copy
on Windows on 99,933,841 of 320 million random arguments, about 31%. The
titles' copy is FreeBSD msun's s_cbrt.c, and cbrt now computes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 22:18:40 -04:00
JJenkx 60f3dcc5db test(libc): check acoshf domain errno and exception flags 2026-10-25 22:06:00 -04:00
Dean 732ab06f41 Merge pull request #10354 from JJenkx/windows/libc-nextafter-msun
fix(libc): compute nextafter and nextafterf with FreeBSD msun's algorithm, as titles' libc.prx does
2026-10-26 14:30:57 +13:00
JJenkxandClaude Opus 5.5 0f7056d67b fix(libc): compute logb and logbf with FreeBSD msun's algorithm, as titles' libc.prx does
logb and logbf returned the host's logb, which sets ERANGE for a zero
argument on Windows and returns signalling NaNs unquieted. The titles'
copies are FreeBSD msun's s_logb.c and s_logbf.c, which set no errno and
quiet a NaN through x * x; both functions now compute that algorithm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 20:50:11 -04:00
Dean Galvin f4d5420b4b Merge branch 'main' into feat/libc-lcosh 2026-10-26 12:28:05 +13:00
Alexandre Figueiredo 40619ba1cc fix(libc): return Dinkumware codes from __fpclassifyf 2026-10-25 23:25:35 +00:00
Adrià 710cf9c035 Merge pull request #9668 from rooklz/fix/libc-acosf-msun
fix(libc): compute acosf with FreeBSD msun's algorithm, as the console's libc.prx does
2026-10-26 00:14:55 +01:00
JJenkxandClaude Opus 5.5 e54e3569f3 fix(libc): compute atan2f with FreeBSD msun's algorithm, as titles' libc.prx does
atan2f returned the host atan2, so its last bit depended on the host: on
Windows it differs from the libc.prx that titles ship on 7,126,466 of
200,001,024 sampled argument pairs. That libc.prx is msun's e_atan2f.c over
its atanf; with two NaN arguments it returns y's. The port gives the same
bits as PPSA07923's, PPSA05916's and PPSA13934's copies on every pair.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:04:28 -04:00
JJenkx 7cfbb837c4 fix(libc): preserve frexpf decomposition and exception behavior 2026-10-25 12:56:59 -04:00
JJenkx 2fc4ca2fd0 test(libc): reject host log fallback in large acoshf inputs 2026-10-25 07:53:43 -04:00
JJenkx 0e895b55be test(libc): cover acoshf positive results across rounding modes 2026-10-25 07:53:11 -04:00
Dean Galvin 80fea7b598 Merge branch 'main' into pr10354 2026-10-25 23:26:47 +13:00
Emanuele 476b63dd45 test(libc): compare the C exception flags in the scaled hyperbolic checks
The _FSinh and _FCosh special-value checks read the raised flags with
fetestexcept(FE_ALL_EXCEPT). On macOS FE_ALL_EXCEPT also holds the x86
denormal-operand flag, which an SSE operation on a subnormal input such
as 0x1p-149 raises, so the check saw 0x2e where it expects 0x2c. glibc
and FreeBSD leave that flag out of FE_ALL_EXCEPT. The checks now read
the five C exception flags.
2026-10-25 10:16:29 +01:00