111
|
1 /* Copyright (C) 2004 Free Software Foundation.
|
|
2
|
|
3 Check that rint, rintf, rintl, lrint, lrintf, lrintl,
|
|
4 llrint, llrintf, llrintl, floor, floorf, floorl,
|
|
5 ceil, ceilf, ceill, trunc, truncf, truncl,
|
|
6 nearbyint, nearbyintf and nearbyintl
|
|
7 built-in functions compile.
|
|
8
|
|
9 Written by Uros Bizjak, 25th Aug 2004. */
|
|
10
|
|
11 /* { dg-do compile } */
|
|
12 /* { dg-options "-O2 -ffast-math" } */
|
|
13
|
|
14 extern double rint(double);
|
|
15 extern long int lrint(double);
|
|
16 extern long long int llrint(double);
|
|
17 extern double floor(double);
|
|
18 extern double ceil(double);
|
|
19 extern double trunc(double);
|
|
20 extern double nearbyint(double);
|
|
21
|
|
22 extern float rintf(float);
|
|
23 extern long int lrintf(float);
|
|
24 extern long long int llrintf(float);
|
|
25 extern float floorf(float);
|
|
26 extern float ceilf(float);
|
|
27 extern float truncf(float);
|
|
28 extern float nearbyintf(float);
|
|
29
|
|
30 extern long double rintl(long double);
|
|
31 extern long int lrintl(long double);
|
|
32 extern long long int llrintl(long double);
|
|
33 extern long double floorl(long double);
|
|
34 extern long double ceill(long double);
|
|
35 extern long double truncl(long double);
|
|
36 extern long double nearbyintl(long double);
|
|
37
|
|
38
|
|
39 double test1(double x)
|
|
40 {
|
|
41 return rint(x);
|
|
42 }
|
|
43
|
|
44 long int test11(double x)
|
|
45 {
|
|
46 return lrint(x);
|
|
47 }
|
|
48
|
|
49 long long int test12(double x)
|
|
50 {
|
|
51 return llrint(x);
|
|
52 }
|
|
53
|
|
54 double test2(double x)
|
|
55 {
|
|
56 return floor(x);
|
|
57 }
|
|
58
|
|
59 double test3(double x)
|
|
60 {
|
|
61 return ceil(x);
|
|
62 }
|
|
63
|
|
64 double test4(double x)
|
|
65 {
|
|
66 return trunc(x);
|
|
67 }
|
|
68
|
|
69 double test5(double x)
|
|
70 {
|
|
71 return nearbyint(x);
|
|
72 }
|
|
73
|
|
74 float test1f(float x)
|
|
75 {
|
|
76 return rintf(x);
|
|
77 }
|
|
78
|
|
79 long int test11f(float x)
|
|
80 {
|
|
81 return lrintf(x);
|
|
82 }
|
|
83
|
|
84 long long int test12f(float x)
|
|
85 {
|
|
86 return llrintf(x);
|
|
87 }
|
|
88
|
|
89 float test2f(float x)
|
|
90 {
|
|
91 return floorf(x);
|
|
92 }
|
|
93
|
|
94 float test3f(float x)
|
|
95 {
|
|
96 return ceilf(x);
|
|
97 }
|
|
98
|
|
99 float test4f(float x)
|
|
100 {
|
|
101 return truncf(x);
|
|
102 }
|
|
103
|
|
104 float test5f(float x)
|
|
105 {
|
|
106 return nearbyintf(x);
|
|
107 }
|
|
108
|
|
109 long double test1l(long double x)
|
|
110 {
|
|
111 return rintl(x);
|
|
112 }
|
|
113
|
|
114 long int test11l(long double x)
|
|
115 {
|
|
116 return lrintl(x);
|
|
117 }
|
|
118
|
|
119 long long int test12l(long double x)
|
|
120 {
|
|
121 return llrintl(x);
|
|
122 }
|
|
123
|
|
124 long double test2l(long double x)
|
|
125 {
|
|
126 return floorl(x);
|
|
127 }
|
|
128
|
|
129 long double test3l(long double x)
|
|
130 {
|
|
131 return ceill(x);
|
|
132 }
|
|
133
|
|
134 long double test4l(long double x)
|
|
135 {
|
|
136 return truncl(x);
|
|
137 }
|
|
138
|
|
139 long double test5l(long double x)
|
|
140 {
|
|
141 return nearbyintl(x);
|
|
142 }
|