1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math" } */
3
4 extern double pow(double, double);
5 extern double fabs(double);
6 extern void abort(void);
7
test2_1(double x)8 double test2_1(double x)
9 {
10 return pow(x,2.0);
11 }
12
test2_2(double x)13 double test2_2(double x)
14 {
15 return pow(-x,2.0);
16 }
17
test2_3(double x)18 double test2_3(double x)
19 {
20 return pow(fabs(x),2.0);
21 }
22
test3_1(double x)23 double test3_1(double x)
24 {
25 return pow(x,3.0);
26 }
27
test3_2(double x)28 double test3_2(double x)
29 {
30 return pow(-x,3.0);
31 }
32
test3_3(double x)33 double test3_3(double x)
34 {
35 return pow(fabs(x),3.0);
36 }
37
test6_1(double x)38 double test6_1(double x)
39 {
40 return pow(x,6.0);
41 }
42
test6_2(double x)43 double test6_2(double x)
44 {
45 return pow(-x,6.0);
46 }
47
test6_3(double x)48 double test6_3(double x)
49 {
50 return pow(fabs(x),6.0);
51 }
52
53
main()54 int main()
55 {
56 if (test2_1(1.0) != 1.0)
57 abort();
58 if (test2_1(2.0) != 4.0)
59 abort();
60 if (test2_1(0.0) != 0.0)
61 abort();
62 if (test2_1(-1.0) != 1.0)
63 abort();
64 if (test2_1(-2.0) != 4.0)
65 abort();
66
67 if (test2_2(1.0) != 1.0)
68 abort();
69 if (test2_2(2.0) != 4.0)
70 abort();
71 if (test2_2(0.0) != 0.0)
72 abort();
73 if (test2_2(-1.0) != 1.0)
74 abort();
75 if (test2_2(-2.0) != 4.0)
76 abort();
77
78 if (test2_3(1.0) != 1.0)
79 abort();
80 if (test2_3(2.0) != 4.0)
81 abort();
82 if (test2_3(0.0) != 0.0)
83 abort();
84 if (test2_3(-1.0) != 1.0)
85 abort();
86 if (test2_3(2.0) != 4.0)
87 abort();
88
89 if (test3_1(1.0) != 1.0)
90 abort();
91 if (test3_1(2.0) != 8.0)
92 abort();
93 if (test3_1(0.0) != 0.0)
94 abort();
95 if (test3_1(-1.0) != -1.0)
96 abort();
97 if (test3_1(-2.0) != -8.0)
98 abort();
99
100 if (test3_2(1.0) != -1.0)
101 abort();
102 if (test3_2(2.0) != -8.0)
103 abort();
104 if (test3_2(0.0) != -0.0)
105 abort();
106 if (test3_2(-1.0) != 1.0)
107 abort();
108 if (test3_2(-2.0) != 8.0)
109 abort();
110
111 if (test3_3(1.0) != 1.0)
112 abort();
113 if (test3_3(2.0) != 8.0)
114 abort();
115 if (test3_3(0.0) != 0.0)
116 abort();
117 if (test3_3(-1.0) != 1.0)
118 abort();
119 if (test3_3(-2.0) != 8.0)
120 abort();
121
122 if (test6_1(1.0) != 1.0)
123 abort();
124 if (test6_1(2.0) != 64.0)
125 abort();
126 if (test6_1(0.0) != 0.0)
127 abort();
128 if (test6_1(-1.0) != 1.0)
129 abort();
130 if (test6_1(-2.0) != 64.0)
131 abort();
132
133 if (test6_2(1.0) != 1.0)
134 abort();
135 if (test6_2(2.0) != 64.0)
136 abort();
137 if (test6_2(0.0) != 0.0)
138 abort();
139 if (test6_2(-1.0) != 1.0)
140 abort();
141 if (test6_2(-2.0) != 64.0)
142 abort();
143
144 if (test6_3(1.0) != 1.0)
145 abort();
146 if (test6_3(2.0) != 64.0)
147 abort();
148 if (test6_3(0.0) != 0.0)
149 abort();
150 if (test6_3(-1.0) != 1.0)
151 abort();
152 if (test6_3(-2.0) != 64.0)
153 abort();
154
155 return 0;
156 }
157
158