aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/ansi/musl-generic-math/lrint.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 18:24:51 -0500
commitf5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch)
tree93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/options/ansi/musl-generic-math/lrint.c
parentbd5969fc876a10b18613302db7087ef3c40f18e1 (diff)
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/options/ansi/musl-generic-math/lrint.c')
-rw-r--r--lib/mlibc/options/ansi/musl-generic-math/lrint.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/mlibc/options/ansi/musl-generic-math/lrint.c b/lib/mlibc/options/ansi/musl-generic-math/lrint.c
deleted file mode 100644
index bdca8b7..0000000
--- a/lib/mlibc/options/ansi/musl-generic-math/lrint.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <limits.h>
-#include <fenv.h>
-#include "libm.h"
-
-/*
-If the result cannot be represented (overflow, nan), then
-lrint raises the invalid exception.
-
-Otherwise if the input was not an integer then the inexact
-exception is raised.
-
-C99 is a bit vague about whether inexact exception is
-allowed to be raised when invalid is raised.
-(F.9 explicitly allows spurious inexact exceptions, F.9.6.5
-does not make it clear if that rule applies to lrint, but
-IEEE 754r 7.8 seems to forbid spurious inexact exception in
-the ineger conversion functions)
-
-So we try to make sure that no spurious inexact exception is
-raised in case of an overflow.
-
-If the bit size of long > precision of double, then there
-cannot be inexact rounding in case the result overflows,
-otherwise LONG_MAX and LONG_MIN can be represented exactly
-as a double.
-*/
-
-#if LONG_MAX < 1U<<53 && defined(FE_INEXACT)
-long lrint(double x)
-{
- #pragma STDC FENV_ACCESS ON
- int e;
-
- e = fetestexcept(FE_INEXACT);
- x = rint(x);
- if (!e && (x > LONG_MAX || x < LONG_MIN))
- feclearexcept(FE_INEXACT);
- /* conversion */
- return x;
-}
-#else
-long lrint(double x)
-{
- return rint(x);
-}
-#endif