gcc/testsuite/gcc.dg/c11-float-7.c
raw| 1 | /* Test C11 definition of LDBL_EPSILON. Based on |
| 2 | gcc.target/powerpc/rs6000-ldouble-2.c. */ |
| 3 | /* { dg-do run } */ |
| 4 | /* { dg-options "-std=c11 -pedantic-errors" } */ |
| 5 | |
| 6 | #include <float.h> |
| 7 | |
| 8 | extern void abort (void); |
| 9 | extern void exit (int); |
| 10 | |
| 11 | int |
| 12 | main (void) |
| 13 | { |
| 14 | volatile long double ee = 1.0; |
| 15 | long double eps = ee; |
| 16 | while (ee + 1.0 != 1.0) |
| 17 | { |
| 18 | eps = ee; |
| 19 | ee = eps / 2; |
| 20 | } |
| 21 | if (eps != LDBL_EPSILON) |
| 22 | abort (); |
| 23 | exit (0); |
| 24 | } |