diff options
author | nsz <nsz@port70.net> | 2012-03-18 19:27:39 +0100 |
---|---|---|
committer | nsz <nsz@port70.net> | 2012-03-18 19:27:39 +0100 |
commit | 9b6899f2c5cec70af6cea80ead7ba98fd2366ce9 (patch) | |
tree | b00581953a70005aaed0760cb62cd77bd269df5c /src/math/lrintf.c | |
parent | 9e2a895aaaa4a3985e94ae4f3e24c1af65f9bb34 (diff) | |
download | musl-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/lrintf.c')
-rw-r--r-- | src/math/lrintf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/math/lrintf.c b/src/math/lrintf.c index caed7ca5..34d1081c 100644 --- a/src/math/lrintf.c +++ b/src/math/lrintf.c @@ -1,6 +1,8 @@ -#define type float -#define roundit rintf -#define dtype long -#define fn lrintf +#include <math.h> -#include "lrint.c" +/* assumes LONG_MAX > 2^24, see comments in lrint.c */ + +long lrintf(float x) +{ + return rintf(x); +} |