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 <<rint>>, <<rintf>>, <<rintl>>---round to integer
26 double rint(double x);
28 long double rintl(long double x);
31 The <<rint>>, <<rintf>> and <<rintl>> functions round <[x]> to an integer value
32 in floating-point format, using the current rounding direction. They may
33 raise the inexact exception if the result differs in value from the argument.
36 These functions return the rounded integer value of <[x]>.
39 <<rint>>, <<rintf>> and <<rintl>> are ANSI.
40 <<rint>> and <<rintf>> are available on all platforms.
41 <<rintl>> is only available on i386 platforms when hardware
42 floating point support is available and when compiling with GCC.
47 * Fast math version of rint(x)
48 * Return x rounded to integral value according to the prevailing
51 * Using inline x87 asms.
53 * Governed by x87 FPCR.
56 double _f_rint (double x
)
59 asm ("frndint" : "=t" (_result
) : "0" (x
));
63 #endif /* !__GNUC__ || _SOFT_FLOAT */