view gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

extern void exit (int);
extern void abort (void);

float
rintf (float x)
{
  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 (-1.5) != -2.0)
    abort ();
  exit (0);
}