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:
parent
9e2a895aaa
commit
9b6899f2c5
6 changed files with 100 additions and 81 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue