| 1 |
/* Test truncation from __float128 to double uses after-rounding |
| 2 |
tininess detection. */ |
| 3 |
|
| 4 |
/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ |
| 5 |
/* { dg-options "" } */ |
| 6 |
/* { dg-require-effective-target fenv_exceptions } */ |
| 7 |
|
| 8 |
#include <fenv.h> |
| 9 |
#include <stdlib.h> |
| 10 |
|
| 11 |
int |
| 12 |
main (void) |
| 13 |
{ |
| 14 |
volatile __float128 a = 0x0.fffffffffffffffp-1022q, b = 0x0.fffffffffffff8p-1022q; |
| 15 |
volatile double r; |
| 16 |
r = (double) a; |
| 17 |
if (fetestexcept (FE_UNDERFLOW)) |
| 18 |
abort (); |
| 19 |
if (r != 0x1p-1022) |
| 20 |
abort (); |
| 21 |
r = (double) b; |
| 22 |
if (!fetestexcept (FE_UNDERFLOW)) |
| 23 |
abort (); |
| 24 |
if (r != 0x1p-1022) |
| 25 |
abort (); |
| 26 |
exit (0); |
| 27 |
} |