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, 28th June 2003. */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void link_error(void);
13 extern double trunc(double);
14 extern double floor(double);
15 extern double ceil(double);
17 extern float truncf(float);
18 extern float floorf(float);
19 extern float ceilf(float);
21 extern long double truncl(long double);
22 extern long double floorl(long double);
23 extern long double ceill(long double);
27 if (trunc (trunc (x
)) != trunc (x
))
29 if (trunc (floor (x
)) != floor (x
))
31 if (trunc (ceil (x
)) != ceil (x
))
34 if (floor (trunc (x
)) != trunc (x
))
36 if (floor (floor (x
)) != floor (x
))
38 if (floor (ceil (x
)) != ceil (x
))
41 if (ceil (trunc (x
)) != trunc (x
))
43 if (ceil (floor (x
)) != floor (x
))
45 if (ceil (ceil (x
)) != ceil (x
))
51 if (truncf (truncf (x
)) != truncf (x
))
53 if (truncf (floorf (x
)) != floorf (x
))
55 if (truncf (ceilf (x
)) != ceilf (x
))
58 if (floorf (truncf (x
)) != truncf (x
))
60 if (floorf (floorf (x
)) != floorf (x
))
62 if (floorf (ceilf (x
)) != ceilf (x
))
65 if (ceilf (truncf (x
)) != truncf (x
))
67 if (ceilf (floorf (x
)) != floorf (x
))
69 if (ceilf (ceilf (x
)) != ceilf (x
))
73 void testl(long double x
)
75 if (truncl (truncl (x
)) != truncl (x
))
77 if (truncl (floorl (x
)) != floorl (x
))
79 if (truncl (ceill (x
)) != ceill (x
))
82 if (floorl (truncl (x
)) != truncl (x
))
84 if (floorl (floorl (x
)) != floorl (x
))
86 if (floorl (ceill (x
)) != ceill (x
))
89 if (ceill (truncl (x
)) != truncl (x
))
91 if (ceill (floorl (x
)) != floorl (x
))
93 if (ceill (ceill (x
)) != ceill (x
))