Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3362 | Serge | 1 | /* |
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 | * ==================================================== |
||
8 | */ |
||
9 | |||
10 | #if defined(__GNUC__) && !defined(_SOFT_FLOAT) |
||
11 | |||
12 | #include |
||
13 | |||
14 | /* |
||
15 | FUNCTION |
||
16 | < |
||
17 | INDEX |
||
18 | rint |
||
19 | INDEX |
||
20 | rintf |
||
21 | INDEX |
||
22 | rintl |
||
23 | |||
24 | ANSI_SYNOPSIS |
||
25 | #include |
||
26 | double rint(double x); |
||
27 | float rintf(float x); |
||
28 | long double rintl(long double x); |
||
29 | |||
30 | TRAD_SYNOPSIS |
||
31 | ANSI-only. |
||
32 | |||
33 | DESCRIPTION |
||
34 | The < |
||
35 | in floating-point format, using the current rounding direction. They may |
||
36 | raise the inexact exception if the result differs in value from the argument. |
||
37 | |||
38 | RETURNS |
||
39 | These functions return the rounded integer value of <[x]>. |
||
40 | |||
41 | PORTABILITY |
||
42 | < |
||
43 | < |
||
44 | < |
||
45 | floating point support is available and when compiling with GCC. |
||
46 | |||
47 | */ |
||
48 | |||
49 | /* |
||
50 | * Fast math version of rint(x) |
||
51 | * Return x rounded to integral value according to the prevailing |
||
52 | * rounding mode. |
||
53 | * Method: |
||
54 | * Using inline x87 asms. |
||
55 | * Exception: |
||
56 | * Governed by x87 FPCR. |
||
57 | */ |
||
58 | |||
59 | double _f_rint (double x) |
||
60 | { |
||
61 | double _result; |
||
62 | asm ("frndint" : "=t" (_result) : "0" (x)); |
||
63 | return _result; |
||
64 | } |
||
65 | |||
66 | #endif /* !__GNUC__ || _SOFT_FLOAT */ |
||
67 |