summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.c
blob: 64d87e13b68065c33957bf85602f549ab2de2c55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern void exit (int);
extern void abort (void);
float x = -1.5f;

float
rintf ()
{
  static const float TWO23 = 8388608.0;

  if (__builtin_fabs (x) < TWO23)
    {
      if (x > 0.0)
        {
          x += TWO23;
          x -= TWO23;
        }
      else if (x < 0.0)
        {
          x = TWO23 - x;
          x = -(x - TWO23);
        }
    }

  return x;
}

int main (void)
{
  if (rintf () != -2.0)
    abort ();
  exit (0);
}