From 9b6899f2c5cec70af6cea80ead7ba98fd2366ce9 Mon Sep 17 00:00:00 2001 From: nsz Date: Sun, 18 Mar 2012 19:27:39 +0100 Subject: 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. --- src/math/llrintf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/math/llrintf.c') diff --git a/src/math/llrintf.c b/src/math/llrintf.c index f06a3c27..e41b6d41 100644 --- a/src/math/llrintf.c +++ b/src/math/llrintf.c @@ -1,6 +1,8 @@ -#define type float -#define roundit rintf -#define dtype long long -#define fn llrintf +#include -#include "lrint.c" +/* assumes LLONG_MAX > 2^24, see comments in lrint.c */ + +long long llrintf(float x) +{ + return rintf(x); +} -- cgit v1.2.1