mirror of
https://github.com/fluencelabs/musl
synced 2025-06-30 15:11:55 +00:00
make lrint and llrint functions work without fenv support
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* assumes LLONG_MAX > 2^53, see comments in lrint.c */
|
/* uses LLONG_MAX > 2^53, see comments in lrint.c */
|
||||||
|
|
||||||
long long llrint(double x)
|
long long llrint(double x)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* assumes LLONG_MAX > 2^24, see comments in lrint.c */
|
/* uses LLONG_MAX > 2^24, see comments in lrint.c */
|
||||||
|
|
||||||
long long llrintf(float x)
|
long long llrintf(float x)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ long long llrintl(long double x)
|
|||||||
{
|
{
|
||||||
return llrint(x);
|
return llrint(x);
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(FE_INEXACT)
|
||||||
/*
|
/*
|
||||||
see comments in lrint.c
|
see comments in lrint.c
|
||||||
|
|
||||||
@ -27,4 +27,9 @@ long long llrintl(long double x)
|
|||||||
/* conversion */
|
/* conversion */
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
long long llrintl(long double x)
|
||||||
|
{
|
||||||
|
return rintl(x);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@ otherwise LONG_MAX and LONG_MIN can be represented exactly
|
|||||||
as a double.
|
as a double.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if LONG_MAX < 1U<<53
|
#if LONG_MAX < 1U<<53 && defined(FE_INEXACT)
|
||||||
long lrint(double x)
|
long lrint(double x)
|
||||||
{
|
{
|
||||||
int e;
|
int e;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* assumes LONG_MAX > 2^24, see comments in lrint.c */
|
/* uses LONG_MAX > 2^24, see comments in lrint.c */
|
||||||
|
|
||||||
long lrintf(float x)
|
long lrintf(float x)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ long lrintl(long double x)
|
|||||||
{
|
{
|
||||||
return lrint(x);
|
return lrint(x);
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(FE_INEXACT)
|
||||||
/*
|
/*
|
||||||
see comments in lrint.c
|
see comments in lrint.c
|
||||||
|
|
||||||
@ -27,4 +27,9 @@ long lrintl(long double x)
|
|||||||
/* conversion */
|
/* conversion */
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
long lrintl(long double x)
|
||||||
|
{
|
||||||
|
return rintl(x);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user