1 /* Copyright (C) 2003 Free Software Foundation.
3 Check that constant folding of built-in math functions doesn't
4 break anything and produces the expected results.
6 Written by Roger Sayle, 5th April 2003. */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void link_error(void);
13 extern double exp(double);
14 extern double sqrt(double);
15 extern double pow(double,double);
17 void test(double x, double y, double z)
19 if (sqrt(x)*sqrt(x) != x)
22 if (sqrt(x)*sqrt(y) != sqrt(x*y))
25 if (exp(x)*exp(y) != exp(x+y))
28 if (pow(x,y)*pow(z,y) != pow(z*x,y))
31 if (pow(x,y)*pow(x,z) != pow(x,y+z))
34 if (x/exp(y) != x*exp(-y))
37 if (x/pow(y,z) != x*pow(y,-z))