1 /* Copyright (C) 2002, 2003 Free Software Foundation.
3 Verify that built-in math function constant folding of constant
4 arguments is correctly performed by the compiler.
6 Written by Roger Sayle, 16th August 2002. */
10 /* All references to link_error should go away at compile-time. */
11 extern void link_error(void);
13 void test (float f
, double d
, long double ld
)
15 if (sqrt (0.0) != 0.0)
18 if (sqrt (1.0) != 1.0)
24 if (exp (1.0) <= 2.71 || exp (1.0) >= 2.72)
39 if (atan (0.0) != 0.0)
42 if (4.0*atan (1.0) <= 3.14 || 4.0*atan (1.0) >= 3.15)
45 if (pow (d
, 0.0) != 1.0)
48 if (pow (1.0, d
) != 1.0)
52 if (sqrtf (0.0F
) != 0.0F
)
55 if (sqrtf (1.0F
) != 1.0F
)
58 if (expf (0.0F
) != 1.0F
)
61 if (expf (1.0F
) <= 2.71F
|| expf (1.0F
) >= 2.72F
)
64 if (logf (1.0F
) != 0.0F
)
67 if (sinf (0.0F
) != 0.0F
)
70 if (cosf (0.0F
) != 1.0F
)
73 if (tanf (0.0F
) != 0.0F
)
76 if (atanf (0.0F
) != 0.0F
)
79 if (4.0F
*atanf (1.0F
) <= 3.14F
|| 4.0F
*atanf (1.0F
) >= 3.15F
)
82 if (powf (f
, 0.0F
) != 1.0F
)
85 if (powf (1.0F
, f
) != 1.0F
)
89 if (sqrtl (0.0L) != 0.0L)
92 if (sqrtl (1.0L) != 1.0L)
95 if (expl (0.0L) != 1.0L)
98 if (expl (1.0L) <= 2.71L || expl (1.0L) >= 2.72L)
101 if (logl (1.0L) != 0.0L)
104 if (sinl (0.0L) != 0.0L)
107 if (cosl (0.0L) != 1.0L)
110 if (tanl (0.0L) != 0.0L)
113 if (atanl (0.0) != 0.0L)
116 if (4.0L*atanl (1.0L) <= 3.14L || 4.0L*atanl (1.0L) >= 3.15L)
119 if (powl (ld
, 0.0L) != 1.0L)
122 if (powl (1.0L, ld
) != 1.0L)
128 test (3.0, 3.0F
, 3.0L);