mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
25
libc/math/nearbyintl.c
Normal file
25
libc/math/nearbyintl.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "libc/math/math.h"
|
||||
|
||||
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
||||
long double nearbyintl(long double x)
|
||||
{
|
||||
return nearbyint(x);
|
||||
}
|
||||
#else
|
||||
#include "libc/math/fenv.h"
|
||||
long double nearbyintl(long double x)
|
||||
{
|
||||
#ifdef FE_INEXACT
|
||||
#pragma STDC FENV_ACCESS ON
|
||||
int e;
|
||||
|
||||
e = fetestexcept(FE_INEXACT);
|
||||
#endif
|
||||
x = rintl(x);
|
||||
#ifdef FE_INEXACT
|
||||
if (!e)
|
||||
feclearexcept(FE_INEXACT);
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue