Skip to content

Commit 3f71ab8

Browse files
committed
[CRT:MATH] Implement _isnan and _isnanf
1 parent e01231b commit 3f71ab8

File tree

6 files changed

+37
-43
lines changed

6 files changed

+37
-43
lines changed

dll/win32/ucrtbase/ucrtbase.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@
560560
@ cdecl _ismbstrail(ptr ptr)
561561
@ cdecl _ismbstrail_l(ptr ptr ptr)
562562
@ cdecl _isnan(double)
563-
@ cdecl -stub -arch=x86_64 _isnanf(float)
563+
@ cdecl -arch=x86_64 _isnanf(float)
564564
@ cdecl _isprint_l(long ptr)
565565
@ cdecl _ispunct_l(long ptr)
566566
@ cdecl _isspace_l(long ptr)

sdk/lib/crt/float/float.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11

2-
list(APPEND LIBCNTPR_FLOAT_SOURCE
3-
float/isnan.c
4-
)
5-
62
list(APPEND CRT_FLOAT_SOURCE
73
${LIBCNTPR_FLOAT_SOURCE}
84
float/chgsign.c

sdk/lib/crt/float/isnan.c

Lines changed: 0 additions & 38 deletions
This file was deleted.

sdk/lib/crt/math/_isnan.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* PROJECT: ReactOS CRT
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Implementation of _isnan.
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <float.h>
9+
#include <stdint.h>
10+
11+
int
12+
__cdecl
13+
_isnan(_In_ double _X)
14+
{
15+
union { double f; uint64_t ui64; } u = { _X };
16+
return (u.ui64 & ~0x8000000000000000ull) > 0x7FF0000000000000ull;
17+
}

sdk/lib/crt/math/_isnanf.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* PROJECT: ReactOS CRT
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Implementation of _isnanf.
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <math.h>
9+
#include <stdint.h>
10+
11+
int
12+
__cdecl
13+
_isnanf(_In_ float _X)
14+
{
15+
union { float f; uint32_t ui32; } u = { _X };
16+
return (u.ui32 & ~0x80000000) > 0x7F800000;
17+
}

sdk/lib/crt/math/math.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ list(APPEND LIBCNTPR_MATH_SOURCE
77
math/_fdsign.c
88
math/_finite.c
99
math/_finitef.c
10+
math/_isnan.c
11+
math/_isnanf.c
1012
math/_invoke_matherr.c
1113
math/abs.c
1214
math/div.c

0 commit comments

Comments
 (0)