[CRT:MATH] Implement _isnan and _isnanf

This commit is contained in:
Timo Kreuzer 2024-11-15 16:36:19 +02:00
parent e01231bd49
commit 3f71ab80ad
6 changed files with 37 additions and 43 deletions

17
sdk/lib/crt/math/_isnan.c Normal file
View file

@ -0,0 +1,17 @@
/*
* PROJECT: ReactOS CRT
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Implementation of _isnan.
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <float.h>
#include <stdint.h>
int
__cdecl
_isnan(_In_ double _X)
{
union { double f; uint64_t ui64; } u = { _X };
return (u.ui64 & ~0x8000000000000000ull) > 0x7FF0000000000000ull;
}

View file

@ -0,0 +1,17 @@
/*
* PROJECT: ReactOS CRT
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Implementation of _isnanf.
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <math.h>
#include <stdint.h>
int
__cdecl
_isnanf(_In_ float _X)
{
union { float f; uint32_t ui32; } u = { _X };
return (u.ui32 & ~0x80000000) > 0x7F800000;
}

View file

@ -7,6 +7,8 @@ list(APPEND LIBCNTPR_MATH_SOURCE
math/_fdsign.c
math/_finite.c
math/_finitef.c
math/_isnan.c
math/_isnanf.c
math/_invoke_matherr.c
math/abs.c
math/div.c