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