#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)
{
#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)
{
{
return llrint(x);
}
-#else
+#elif defined(FE_INEXACT)
/*
see comments in lrint.c
/* conversion */
return x;
}
+#else
+long long llrintl(long double x)
+{
+ return rintl(x);
+}
#endif
as a double.
*/
-#if LONG_MAX < 1U<<53
+#if LONG_MAX < 1U<<53 && defined(FE_INEXACT)
long lrint(double x)
{
int e;
#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)
{
{
return lrint(x);
}
-#else
+#elif defined(FE_INEXACT)
/*
see comments in lrint.c
/* conversion */
return x;
}
+#else
+long lrintl(long double x)
+{
+ return rintl(x);
+}
#endif