27 May
2025
27 May
'25
8:03 a.m.
Piotr Caban (@piotr) commented about libs/musl/src/complex/cexp.c:
+ +#include "complex_impl.h" + +static const uint32_t +exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */ +cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ + +extern double __cdecl __exp(double x, matherr_t matherr); + +static double cexp_callback( int type, const char *name, double arg1, double arg2, double retval ) +{ + switch (type) { + case _UNDERFLOW: + case _OVERFLOW: + errno = ERANGE; + break; Should `errno` be set on undeflow? It's probably better to copy switch cases ffrom `dlls/msvcrt/math.c -> math_error()`:
case _DOMAIN:
errno = EDOM;
break;
case _SING:
case _OVERFLOW:
errno = ERANGE;
break;
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7748#note_104661