Debian Codegraph @

gcc/testsuite/gcc.dg/torture/float128-truncsf-underflow.c

raw
1 /* Test truncation from __float128 to float 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.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);
27 }