1 /* Copyright (C) 2004 Free Software Foundation.
3 Check that constant folding of round, roundf and roundl math functions
4 doesn't break anything and produces the expected results.
6 Written by Roger Sayle, 22nd January 2004. */
9 /* { dg-options "-O2" } */
11 extern void link_error(void);
13 extern double round(double);
14 extern float roundf(float);
15 extern long double roundl(long double);
19 if (round (0.0) != 0.0)
21 if (round (6.0) != 6.0)
23 if (round (-8.0) != -8.0)
26 if (round (3.2) != 3.0)
28 if (round (-2.8) != -3.0)
30 if (round (0.01) != 0.0)
32 if (round (-0.7) != -1.0)
35 if (round (2.5) != 3.0)
37 if (round (-1.5) != -2.0)
43 if (roundf (0.0f) != 0.0f)
45 if (roundf (6.0f) != 6.0f)
47 if (roundf (-8.0f) != -8.0f)
50 if (roundf (3.2f) != 3.0f)
52 if (roundf (-2.8f) != -3.0f)
54 if (roundf (0.01f) != 0.0f)
56 if (roundf (-0.7f) != -1.0f)
59 if (roundf (2.5f) != 3.0f)
61 if (roundf (-1.5f) != -2.0f)
67 if (roundl (0.0l) != 0.0l)
69 if (roundl (6.0l) != 6.0l)
71 if (roundl (-8.0l) != -8.0l)
74 if (roundl (3.2l) != 3.0l)
76 if (roundl (-2.8l) != -3.0l)
78 if (roundl (0.01l) != 0.0l)
80 if (roundl (-0.7l) != -1.0l)
83 if (roundl (2.5l) != 3.0l)
85 if (roundl (-1.5l) != -2.0l)