* gcc.dg/ucnid-[23456].c: XFAIL on AIX.
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-8.c
blobc3066b41cabb14493b4443833dfac64d8184cd88
1 /* Copyright (C) 2003 Free Software Foundation.
3 Verify that built-in math function constant folding of functions
4 with one constant argument is correctly performed by the compiler.
6 Written by Roger Sayle, 30th March 2003. */
8 /* { dg-do run } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void abort(void);
12 extern double pow(double, double);
13 extern double sqrt(double);
15 void test(double x)
17 if (pow(x,-1.0) != 1.0/x)
18 abort ();
20 if (pow(x,2.0) != x*x)
21 abort ();
23 if (pow(x,-2.0) != 1.0/(x*x))
24 abort ();
26 if (pow(x,0.5) != sqrt(x))
27 abort ();
30 int main()
32 test (1.0);
33 test (2.0);
34 return 0;