111
|
1 /* Copyright (C) 2005 Free Software Foundation.
|
|
2
|
|
3 Check that (long)floor, (long)floorf, (long)floorl,
|
|
4 (long long)floor, (long long)floorf, (long long)floorl,
|
|
5 (long)ceil, (long)ceilf, (long)ceill,
|
|
6 (long long)ceil, (long long)ceilf, (long long)ceill
|
|
7 built-in functions compile.
|
|
8
|
|
9 Written by Uros Bizjak, 5th April 2005. */
|
|
10
|
|
11 /* { dg-do compile } */
|
|
12 /* { dg-options "-O2 -ffast-math" } */
|
|
13 /* { dg-add-options c99_runtime } */
|
|
14
|
|
15 #include "builtins-config.h"
|
|
16
|
|
17 extern double floor(double);
|
|
18 extern double ceil(double);
|
|
19 extern double trunc(double);
|
|
20
|
|
21 extern float floorf(float);
|
|
22 extern float ceilf(float);
|
|
23 extern float truncf(float);
|
|
24
|
|
25 extern long double floorl(long double);
|
|
26 extern long double ceill(long double);
|
|
27 extern long double truncl(long double);
|
|
28
|
|
29
|
|
30 long int test1(double x)
|
|
31 {
|
|
32 return floor(x);
|
|
33 }
|
|
34
|
|
35 long long int test2(double x)
|
|
36 {
|
|
37 return floor(x);
|
|
38 }
|
|
39
|
|
40 long int test3(double x)
|
|
41 {
|
|
42 return ceil(x);
|
|
43 }
|
|
44
|
|
45 long long int test4(double x)
|
|
46 {
|
|
47 return ceil(x);
|
|
48 }
|
|
49
|
|
50 long int test5(double x)
|
|
51 {
|
|
52 return trunc(x);
|
|
53 }
|
|
54
|
|
55 long long int test6(double x)
|
|
56 {
|
|
57 return trunc(x);
|
|
58 }
|
|
59
|
|
60 #ifdef HAVE_C99_RUNTIME
|
|
61 long int test1f(float x)
|
|
62 {
|
|
63 return floorf(x);
|
|
64 }
|
|
65
|
|
66 long long int test2f(float x)
|
|
67 {
|
|
68 return floorf(x);
|
|
69 }
|
|
70
|
|
71 long int test3f(float x)
|
|
72 {
|
|
73 return ceilf(x);
|
|
74 }
|
|
75
|
|
76 long long int test4f(float x)
|
|
77 {
|
|
78 return ceilf(x);
|
|
79 }
|
|
80 #endif
|
|
81
|
|
82 long int test5f(float x)
|
|
83 {
|
|
84 return truncf(x);
|
|
85 }
|
|
86
|
|
87 long long int test6f(float x)
|
|
88 {
|
|
89 return truncf(x);
|
|
90 }
|
|
91
|
|
92 #ifdef HAVE_C99_RUNTIME
|
|
93 long int test1l(long double x)
|
|
94 {
|
|
95 return floorl(x);
|
|
96 }
|
|
97
|
|
98 long long int test2l(long double x)
|
|
99 {
|
|
100 return floorl(x);
|
|
101 }
|
|
102
|
|
103 long int test3l(long double x)
|
|
104 {
|
|
105 return ceill(x);
|
|
106 }
|
|
107
|
|
108 long long int test4l(long double x)
|
|
109 {
|
|
110 return ceill(x);
|
|
111 }
|
|
112 #endif
|
|
113
|
|
114 long int test5l(long double x)
|
|
115 {
|
|
116 return truncl(x);
|
|
117 }
|
|
118
|
|
119 long long int test6l(long double x)
|
|
120 {
|
|
121 return truncl(x);
|
|
122 }
|