126 Commits
Author SHA1 Message Date
hypermistandClaude Opus 5.5 8e46144d48 fix(libc): follow the console for integer bases and 0x prefixes
- strtol, strtoul, strtoll, strtoull and strtouq return 0 for a base
  outside 0 and 2 to 36, leave the end at the start and set EINVAL;
  strtoimax, strtoumax, _Stoull, _Stoul and the wide forms do the same
  without errno.
- A 0x prefix with no hexadecimal digit after it (base 0 or 16) is no
  conversion: the end stays at the start of the string.
- wcstol, wcstoll and wcstoimax take one sign, convert the rest with
  wcstoull and clamp to the signed range with ERANGE, so "- 1" is -1
  and "+\t-1" overflows.
- atoi, atol and atoll truncate strtoull's result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 16:05:00 +13:00
Dean 1ffe979127 Merge pull request #8576 from priyanshrv-netizen/feat/libc-float-characteristics
feat(libc): export the Dinkumware float characteristic tables
2026-10-21 14:06:48 +13:00
Dean 21a57ff5c0 Merge pull request #8570 from priyanshrv-netizen/feat/libc-dinkumware-constants
feat(libc): export the remaining Dinkumware floating-point constants
2026-10-21 13:29:16 +13:00
Dean 5b59fbc553 Merge pull request #8389 from SwetabhSingh17/feat/libc-math-significand
feat(libc): implement significand
2026-10-21 12:40:42 +13:00
Dean 1bf237cc33 Merge pull request #8379 from hypermoist/fix/libc-strtod-subnormal-errno
fix(libc): leave errno alone for subnormal strtod results
2026-10-21 12:14:17 +13:00
Dean 542c65d74c Merge pull request #8023 from Ondra97/codex/fix-scaled-hyperbolic
fix(libc): avoid premature scaled hyperbolic overflow
2026-10-21 06:26:06 +13:00
priyanshrv-netizenandClaude Opus 5.5 97d587f730 feat(libc): export the Dinkumware float characteristic tables
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>
2026-10-20 22:28:18 +05:30
priyanshrv-netizenandClaude Opus 5.5 91c401db5e feat(libc): export the remaining Dinkumware floating-point constants
Add _Denorm, _Hugeval, _Nan, _Snan, _FDenorm, _FSnan, _LDenorm, _LInf,
_LNan and _LSnan with the 16 bytes the console's libc.prx exports.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 22:15:51 +05:30
Adrià d073fe6a1d Merge pull request #7524 from jotitadev/fix/macos-guest-math-bessel-reference
fix(tests): compare the Bessel exports with fixed reference values
2026-10-20 17:16:08 +02:00
Swetabh Singh dbd849d3c1 feat(libc): implement significand 2026-10-20 17:25:00 +05:30
hypermistandClaude Opus 5.5 b455c751bb fix(libc): leave errno alone for subnormal strtod results
The console's strtof, strtod and strtold set ERANGE only when a
conversion underflows to zero; a non-zero subnormal result leaves errno
unchanged, while the host's sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 00:48:05 +13:00
Adrià 6bd02dd915 Merge pull request #7545 from ionut27001/fix/libc-strtod-nan-payload
fix(libc): parse NaN payloads in strtod as measured on a PS5
2026-10-20 12:25:58 +02:00
Dean a569f47cb7 Merge pull request #7876 from ErenYeager1836/feat/libc-export-tgammaf
feat(libc): export tgammaf float math function
2026-10-20 13:52:11 +13:00
Jota f8545e961e fix(tests): compare the Bessel exports with fixed reference values
libc++ does not provide std::cyl_bessel_j or std::cyl_neumann, so
GuestMath.cpp stopped compiling on macOS after the Bessel exports were
added. The three checks now compare against the values of J0(2.5),
J3(4.0) and Y2(3.0), which glibc and macOS libm agree on to 1e-16.
2026-10-19 15:24:58 -03:00
Ondra97 ce81a77d1a fix(libc): avoid premature scaled hyperbolic overflow 2026-10-19 19:47:19 +02:00
Dean a39411c67a Merge pull request #7906 from Rajkamalcode/fix/libc-bessel-zero
fix(libc): return -inf from y0f, y1f and ynf at zero
2026-10-20 05:52:35 +13:00
Rajkamalcode cea6fabfae fix(libc): return -inf from y0f, y1f and ynf at zero
The guest's second-kind Bessel functions return -inf and raise the divide-by-zero exception for x = +-0 (see e_jn.c), but the UCRT returns NaN for y1 and yn. Route x == +-0 through a shared helper, cover ynf(2, 0) in the guest math test, and note the special case in the libc technical debt.
2026-10-19 18:31:00 +05:30
Nithishvelan M 0f34160a49 feat(libc): export tgammaf float math function
PPSA26578 (issue #7624) imports tgammaf (NID B2ZbqV9geCM) from libc,
and its bundled libc.prx does not export it, causing the process to
exit with 0xC0000139 (GetLastError: 127).

Export tgammaf_nid_postfix in core/libs/prx/libc/src/Math.cpp delegating
to std::tgamma(float), and add unit test coverage in GuestMath
verifying factorials, half-integers, poles, and negative values.
2026-10-19 17:27:50 +05:30
Nithishvelan M 6487d5e2c5 feat(libc): export nextafter double math function
PPSA26578 (issue #7624) imports nextafter (NID h+J60RRlfnk) from libc,
and its bundled libc.prx does not export it, causing the process to
exit with 0xC0000139 (GetLastError: 127).

Export nextafter_nid_postfix in core/libs/prx/libc/src/Math.cpp delegating
to std::nextafter(double, double), and add unit test coverage in
GuestMath verifying denormals, infinities, NaNs, and negative zero.
2026-10-19 17:25:31 +05:30
ionut27001andClaude Opus 5.5 ae662c873d fix(libc): parse NaN payloads in strtod as measured on a PS5
In a payload process on a PS5 (firmware 12.70), the strtod and wcstod
of libSceLibcInternal.sprx keep the payload of a NAN(...) sequence,
read as FreeBSD 11's gdtoa hexnan reads it, under the quiet bit and
with the sign. strtof, wcstof, strtold and wcstold return the positive
default quiet NaN whatever the sign and the sequence, and consume a
sequence of letters, digits and underscores up to its closing
parenthesis. Here every NaN lost its payload, and strtof and strtold
kept the sign.

The model reproduces the 64 NaN inputs that p11, p14, p27 and p33
measured, including blanks and other characters inside the parentheses
and unterminated sequences, and the test now pins them. It also pins
two p71 cases measured through strtod: nan(1 2), and "nan( " followed
by NUL and ")". In hexnan, a blank after a payload digit, while a
32-bit word of the payload is still free, starts a blank skip that has
no NUL check, so when only blanks follow up to the terminating NUL the
console reads past it (p71); that case throws here. A blank right after
"nan(" is skipped with a NUL check, and the console stopped at the NUL
there.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:20:41 +03:00
BIGFERRY999 b28a84d421 feat(libc): implement ceill and floorl 2026-10-19 01:14:40 +02:00
BIGFERRY999 6e3ae1c02e feat(libc): implement fmaf 2026-10-19 00:46:38 +02:00
BIGFERRY999 994fd66bf4 feat(libc): implement remquo and remquof 2026-10-19 00:10:02 +02:00
BIGFERRY999 f7dce6e2d4 feat(libc): implement copysign and copysignf 2026-10-18 22:23:40 +02:00
Adrià f3059421f3 Merge pull request #6166 from freshstart2066-create/feat/libc-fabsf-fabsl
feat(libc): implement fabsf and fabsl
2026-10-18 22:09:51 +02:00
Adrià c73787f443 Merge pull request #6157 from freshstart2066-create/feat/libc-erf-erfc
feat(libc): implement erf, erfc, and erfcf
2026-10-18 20:49:50 +02:00
Adrià 023106ae4b Merge pull request #6159 from freshstart2066-create/feat/libc-ilogb
feat(libc): implement ilogb and ilogbf
2026-10-18 20:23:00 +02:00
BIGFERRY999 831ecb05f7 feat(libc): implement fabsf and fabsl 2026-10-18 20:02:41 +02:00
Adrià FranchandClaude Sonnet 5.5 3b5c41b20f fix(libc): ilogb special cases match PS5 libc.prx (0 -> INT_MIN, inf/NaN -> INT_MAX)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 18:49:34 +02:00
BIGFERRY999 0edfefaf18 feat(libc): implement ilogb and ilogbf 2026-10-18 18:49:25 +02:00
BIGFERRY999 5509b6c701 feat(libc): implement erf, erfc, and erfcf 2026-10-18 18:43:58 +02:00
BIGFERRY999 c33cf11f06 feat(libc): implement fdim and fdimf 2026-10-18 18:42:52 +02:00
T3cm0andClaude Opus 5.5 24a999c499 feat(libc): implement long double, Bessel and integer math exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 20:43:13 -05:00
hypermistandClaude Opus 5.5 20edd079e4 fix(libc): store the sign of gamma in an exported signgam from lgamma
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:11:02 +13:00
Adrià ec1193dc39 Merge pull request #5775 from wachi35676/fix/libc-lgamma-tiny-arguments
fix(libc): keep lgamma finite for subnormal arguments on Windows
2026-10-15 18:36:22 +02:00
Adrià 08290338aa Merge pull request #5599 from JJenkx/feat/libc-isfinitel
feat(libc): implement x87 long-double finite classification
2026-10-15 17:03:18 +02:00
Karim IbrahimandClaude Opus 5.5 f49c54243f refactor(libc): move fegetenv and its test out of the lines #5495 changes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 34cf0e223f test(libc): cover fegetenv with a null environment and pending x87 flags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 74b93adb6c feat(libc): implement fegetenv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:02:31 +02:00
Muhammad Wasif Ali WasifandClaude Opus 5.5 e671332d2e fix(libc): keep lgamma finite for subnormal arguments on Windows
The MinGW-w64 lgamma overflows to infinity for nonzero |x| at or below 2^-1024. FreeBSD msun e_lgamma_r.c returns -log(|x|) for every nonzero |x| below 2^-56, so take that branch before the host function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:03:50 +05:00
JJenkx 2f9d04fb77 chore: resolve current upstream integration conflicts 2026-10-13 23:13:49 -04:00
Dean 34355eeeac Merge pull request #4942 from QRMOE/fix-libc-llroundl-upper-bound
fix(libc): accept the full llroundl integer range
2026-10-14 14:29:14 +13:00
JJenkx aa16bfc632 Merge commit '30f961266ade83b41d5c9de7dec1393e7fcecfb7' into feat/libc-isfinitel 2026-10-13 18:59:59 -04:00
hamb3r 8652dbe35b feat(libc): add missing Unity IL2CPP runtime imports and Dinkumware helpers
Add missing libc.prx symbols required by Unity IL2CPP runtime:
- Implement _Dtest double classification in Math.cpp
- Implement _Inf double constant in Math.cpp
- Implement sceLibcBacktraceGetBufferSize and sceLibcBacktraceSelf in Backtrace.cpp
- Implement _Cnd_signal in Threads.cpp
- Implement _ZNSt8ios_base7_AddstdEPS_ in RuntimeSupport.cpp
- Implement __pointer_type_info and __function_type_info vtables in TypeInfo.cpp
- Remove duplicate stubs from libSceAmpr/Export.cpp
- Add unit tests in GuestMath.cpp and GuestLibcThreads.cpp
- Document unverified behaviors in docs/dev/debt/libc.md
2026-10-13 19:01:30 +03:00
Adrià 091c136ba6 Merge pull request #5223 from Nixitov/feat/libc-float-math
feat(libc): implement the missing float rounding and classification exports
2026-10-13 17:43:06 +02:00
Adrià 7e4edf509a Merge pull request #4616 from EagleBearerYS/fix/libc-strtod-quiet-nan-windows
fix(libc): return the default quiet NaN from the strtod family
2026-10-13 17:11:55 +02:00
Nixitov 00f0589101 feat(libc): implement the float rounding and classification exports
PPSA99611 imports ceilf, floorf, truncf, isnan and isinf from libc.prx and stops at start-up on main. Implement them next to the existing double forms: the rounding results delegate to the standard library like the other float exports, and isnan/isinf reuse the __isnan/__isinf helpers isnanf already uses.
2026-10-13 17:09:47 +02:00
Akul Tyagi b4e2ee0a13 feat(libc): implement __powidf2
The H+8UBOwfScI import was a throwing stub (libcCyberUnknown08). It is
the NID of "__powidf2", the double-precision integer-power helper that
complements __powisf2.
2026-10-13 19:00:24 +05:30
AlexandClaude Sonnet 5.5 988d304c5c fix(libc): keep the acosf result and leave errno unchanged
The previous commit replaced the out-of-range result with the default
quiet NaN 0x7fc00000, but main and FreeBSD e_acosf.c return 0xffc00000.

acosf now calls the host and restores errno, so only errno differs from
main. The guest test pins the result bits for 2.0f and -2.0f and keeps
the in-range case acosf(0.5f).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 11:49:14 +02:00
AlexandClaude Haiku 5.5 64e244eb70 fix(libc): match FreeBSD acosf errno
acosf returned 0xffc00000 (errno 33) for 2.0 (0x40000000), where FreeBSD
lib/msun/src/math.h returns 0xffc00000 (errno 0).

It now returns the FreeBSD result for that case. A guest test covers it
and fails on main.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-13 11:49:14 +02:00