1 /*
2 Copyright (c) 2007 Dave Korn
3
4
5 x87 FP implementation contributed to Newlib by
6 Dave Korn, November 2007. This file is placed in the
7 public domain. Permission to use, copy, modify, and
8 distribute this software is freely granted.
9 */
10 /*
11 * ====================================================
12 * x87 FP implementation contributed to Newlib by
13 * Dave Korn, November 2007. This file is placed in the
14 * public domain. Permission to use, copy, modify, and
15 * distribute this software is freely granted.
16 * ====================================================
17 */
18
19 #if defined(__GNUC__) && !defined(_SOFT_FLOAT)
20
21 #include <math.h>
22 #include "f_math.h"
23
24 /*
25 * Fast math version of rintf(x)
26 * Return x rounded to integral value according to the prevailing
27 * rounding mode.
28 * Method:
29 * Using inline x87 asms.
30 * Exception:
31 * Governed by x87 FPCR.
32 */
33
_f_rintf(float x)34 float _f_rintf (float x)
35 {
36 float _result;
37 __asm__("frndint" : "=t" (_result) : "0" (x));
38 return _result;
39 }
40
41 #endif /* !__GNUC__ || _SOFT_FLOAT */
42
43