Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / float128-truncsf-underflow.c
blob3f1a71366d27c50c68fc40e4f659ee31565b247b
1 /* Test truncation from __float128 to float uses after-rounding
2 tininess detection. */
4 /* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
5 /* { dg-options "" } */
6 /* { dg-require-effective-target fenv_exceptions } */
8 #include <fenv.h>
9 #include <stdlib.h>
11 int
12 main (void)
14 volatile __float128 a = 0x0.ffffffffffp-126q, b = 0x0.ffffffp-126q;
15 volatile float r;
16 r = (float) a;
17 if (fetestexcept (FE_UNDERFLOW))
18 abort ();
19 if (r != 0x1p-126f)
20 abort ();
21 r = (float) b;
22 if (!fetestexcept (FE_UNDERFLOW))
23 abort ();
24 if (r != 0x1p-126f)
25 abort ();
26 exit (0);