xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 extern void exit (int);
2 extern void abort (void);
3 
4 float
5 rintf (float x)
6 {
7   static const float TWO23 = 8388608.0;
8 
9   if (__builtin_fabs (x) < TWO23)
10     {
11       if (x > 0.0)
12         {
13           x += TWO23;
14           x -= TWO23;
15         }
16       else if (x < 0.0)
17         {
18           x = TWO23 - x;
19           x = -(x - TWO23);
20         }
21     }
22 
23   return x;
24 }
25 
26 int main (void)
27 {
28   if (rintf (-1.5) != -2.0)
29     abort ();
30   exit (0);
31 }
32