2 * ====================================================
3 * x87 FP implementation contributed to Newlib by
4 * Dave Korn, November 2007. This file is placed in the
5 * public domain. Permission to use, copy, modify, and
6 * distribute this software is freely granted.
7 * ====================================================
10 #if defined(__GNUC__) && !defined(_SOFT_FLOAT)
16 <<lrint>>, <<lrintf>>, <<lrintl>>---round and convert to long integer
26 long int lrint(double x);
27 long int lrintf(float x);
28 long int lrintl(long double x);
31 The <<lrint>>, <<lrintf>> and <<lrintl>> functions round <[x]> to the nearest integer value,
32 according to the current rounding direction. If the rounded value is outside the
33 range of the return type, the numeric result is unspecified. A range error may
34 occur if the magnitude of <[x]> is too large.
37 These functions return the rounded integer value of <[x]>.
38 <<lrint>>, <<lrintf>> and <<lrintl>> return the result as a long integer.
41 <<lrint>>, <<lrintf>>, and <<lrintl>> are ANSI.
42 <<lrint>> and <<lrintf>> are available on all platforms.
43 <<lrintl>> is only available on i386 platforms when hardware
44 floating point support is available and when compiling with GCC.
49 * Fast math version of lrint(x)
50 * Return x rounded to integral value according to the prevailing
53 * Using inline x87 asms.
55 * Governed by x87 FPCR.
58 long int _f_lrint (double x
)
61 asm ("fistpl %0" : "=m" (_result
) : "t" (x
) : "st");
65 #endif /* !__GNUC__ || _SOFT_FLOAT */