OSDN Git Service

* builtins.c (dconstpi, dconste): New mathematical constants.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-7.c
1 /* Copyright (C) 2003  Free Software Foundation.
2
3    Verify that built-in math function constant folding of constant
4    arguments is correctly performed by the by the compiler.
5
6    Written by Roger Sayle, 30th March 2003.  */
7
8 /* { dg-do link } */
9 /* { dg-options "-O2 -ffast-math" } */
10
11 extern void link_error(void);
12
13 void test(double x)
14 {
15   if (pow (x, 1.0) != x)
16     link_error ();
17   if (tan (atan (x)) != x)
18     link_error ();
19 }
20
21 void testf(float x)
22 {
23   if (powf (x, 1.0f) != x)
24     link_error ();
25   if (tanf (atanf (x)) != x)
26     link_error ();
27 }
28
29 void testl(long double x)
30 {
31   if (powl (x, 1.0l) != x)
32     link_error ();
33   if (tanl (atanl (x)) != x)
34     link_error ();
35 }
36
37 int main()
38 {
39   test (2.0);
40   testf (2.0f);
41   testl (2.0l);
42
43   return 0;
44 }
45