[PATCH v2] msvcrt: Make the cosh/sinh/tanh functions NAN preserving
Piotr Caban
piotr.caban at gmail.com
Fri Jul 16 14:52:10 CDT 2021
Hi Martin,
On 7/16/21 2:05 PM, Martin Storsjo wrote:
> @@ -1139,6 +1139,9 @@ float CDECL coshf( float x )
> UINT32 ui = *(UINT32*)&x;
> float t;
>
> + if (isnan(x))
> + return x;
> +
A quick test shows that ucrtbase returns something like:
if (isnan(x)) {
*(DWORD*)&x |= 0x400000;
return x;
}
Probably it will make sense to move the code to integrate better with
musl implementation. Instead of checking for nan with isnan function it
can be done here:
/* |x| > log(FLT_MAX) or nan */
if (ui > 0x7f800000)
*(DWORD*)&t = *(DWORD*)&x | 0x400000;
else
t = __expo2f(x, 1.0f);
return t;
Thanks,
Piotr
More information about the wine-devel
mailing list