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.
This commit is contained in:
nsz
2012-03-18 19:27:39 +01:00
parent 9e2a895aaa
commit 9b6899f2c5
6 changed files with 100 additions and 81 deletions

View File

@ -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);
}