libc: double and float libm against the libc.prx bundled with PPSA10122 (SDK 5.00): flags and errno on Windows #23411
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 DerKarussellbremser on 2026-11-19T00:49:10Z.
The
doubleandfloatcounterpart of #22838: the same harness, the same module (sce_module/libc.prxof PPSA10122 01.101.000, SDK 5.00, run natively on Windows), 43 functions in each precision, 200,000 arguments or pairs per function, this libc atmain9ffa95e7d9.Arguments are a quarter raw bit patterns (NaNs, infinities and subnormals included), a quarter uniform in ±4, a quarter uniform in ±40 and a quarter with exponents from 2^-20 to 2^20. Compared are the result bits (two NaNs count as equal), the union of the x87 and MXCSR exception flags, and
errno. A row counts under "flags" only if its bits agree, and under "errno" only if bits and flags agree.Identical in all three (57 of 86):
sin,cos,tan,acos,sinh,cosh,tanh,asinh,acosh,atanh,exp,exp2,expm1,log,log2,log10,log1p,cbrt,sqrt,ceil,floor,trunc,rint,logb,fabs,pow,hypot,remainder,fmax,fmin,copysign,nextafter, and forfloatsinf,cosf,tanf,sinhf,asinhf,acoshf,atanhf,exp2f,expm1f,log2f,log10f,cbrtf,sqrtf,ceilf,floorf,truncf,rintf,logbf,fabsf,hypotf,remainderf,fmaxf,fminf,copysignf,nextafterf.Different
errnoround,roundfFE_INEXACTfrom 2^53 / 2^24 up. Fixed in #23410.fdim,fdimfasin,atanFE_INEXACT, this libc nothingasinf,atanfatanfalso raisesFE_UNDERFLOWcoshfFE_INEXACT. Overflow: module setsERANGEtanhfFE_INEXACT. Large argument (result ±1): this libc raises it, the module does noterf,erfcFE_INEXACT, the module nothingatan2fFE_UNDERFLOW(seen with results ±pi and with tiny results)powfFE_OVERFLOW(seen with a huge base and a small or negative exponent)logfFE_INVALIDand setsEDOMlgammaFE_INVALID, the module nothingatan2,fmod,nearbyint,acosf,nearbyintf,fmodf,tgammafatan2the other way round)tgammaFE_DIVBYZEROin the module andFE_OVERFLOWherelgammafexpflog1pferff,erfcfHow I read it. Apart from the last five rows this is all exception flags, and most of it looks like compiler output rather than different algorithms: where msun writes
if (huge + x > one) return x;the module's build really does the addition, and where msun writesone - tinywith two constants the module's build has folded it, so no flag is raised. Theroundfamily is the same kind of thing (the unselectedt + 1is computed).I have not changed any of these beyond #23410. Several debt entries state the current flag behaviour on purpose or say flags are not compared (
asinfandatanf: "Tiny arguments returnxwithout raisingFE_INEXACT";asin,atan,tanhf: flags not compared), and those entries rest on other titles' modules. Whether a different title's build folds the same expressions is exactly what one module cannot tell. If the flags of this module are wanted for some of these rows, say which, and I will do them one function per pull request.Limits. One module, one SDK version, a Windows host. MXCSR left at round-to-nearest. NaN payloads are not compared. The examples column is from the first few differing arguments of each row, not from all of them.
AI-assisted (Claude Code); the runs are from my machine.