about summary refs log tree commit diff
path: root/src/math/llrint.c
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-03-18 19:27:39 +0100
committernsz <nsz@port70.net>2012-03-18 19:27:39 +0100
commit9b6899f2c5cec70af6cea80ead7ba98fd2366ce9 (patch)
treeb00581953a70005aaed0760cb62cd77bd269df5c /src/math/llrint.c
parent9e2a895aaaa4a3985e94ae4f3e24c1af65f9bb34 (diff)
downloadmusl-9b6899f2c5cec70af6cea80ead7ba98fd2366ce9.tar.gz
musl-9b6899f2c5cec70af6cea80ead7ba98fd2366ce9.tar.xz
musl-9b6899f2c5cec70af6cea80ead7ba98fd2366ce9.zip
faster lrint and llrint functions
A faster workaround for spurious inexact exceptions
when the result cannot be represented. The old code
actually could be wrong, because gcc reordered the
integer conversion and the exception check.
Diffstat (limited to 'src/math/llrint.c')
-rw-r--r--src/math/llrint.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/math/llrint.c b/src/math/llrint.c
index c0a40721..ee783b8e 100644
--- a/src/math/llrint.c
+++ b/src/math/llrint.c
@@ -1,8 +1,8 @@
-#define type            double
-#define roundit         rint
-#define dtype           long long
-#define fn              llrint
-
-#include "lrint.c"
+#include <math.h>
 
+/* assumes LLONG_MAX > 2^53, see comments in lrint.c */
 
+long long llrint(double x)
+{
+	return rint(x);
+}