[CRT:MATH] Implement _finite, _finitef

This commit is contained in:
Timo Kreuzer 2024-12-02 20:17:14 +02:00
parent 50028685dc
commit e01231bd49
5 changed files with 41 additions and 17 deletions

View file

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

View file

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

View file

@ -5,6 +5,8 @@ list(APPEND LIBCNTPR_MATH_SOURCE
math/_chgsignf.c
math/_dsign.c
math/_fdsign.c
math/_finite.c
math/_finitef.c
math/_invoke_matherr.c
math/abs.c
math/div.c