gcc/testsuite/gcc.dg/c23-float-12.c
raw| 1 | /* Test C23 definition of LDBL_EPSILON. */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 | |
| 5 | #include <float.h> |
| 6 | |
| 7 | extern void abort (void); |
| 8 | extern void exit (int); |
| 9 | |
| 10 | int |
| 11 | main (void) |
| 12 | { |
| 13 | volatile long double x = 1.0L; |
| 14 | for (int i = 0; i < LDBL_MANT_DIG - 1; i++) |
| 15 | x /= 2; |
| 16 | if (x != LDBL_EPSILON) |
| 17 | abort (); |
| 18 | exit (0); |
| 19 | } |