OSDN Git Service

* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / fe-convert-1.c
1 /* { dg-options "-std=gnu99" } */
2
3 /* Check that appropriate exceptions are raised for conversions involving
4    decimal float values.  */
5
6 #include "fe-check.h"
7
8 volatile _Decimal32 d32;
9 volatile _Decimal64 d64;
10 volatile _Decimal128 d128;
11
12 /* Conversions between decimal float types should raise an invalid
13    exception if the values doesn't fit, either because the value
14    is too large or the result can't hold the full precision.  */
15
16 CONVERT (100, d64, d32, 9.999999e96DD, 0)
17 CONVERT (101, d64, d32, 10.000000e96DD, FE_INEXACT)
18 CONVERT (102, d64, d32, 1.1111111DD, FE_INEXACT)
19 CONVERT (110, d128, d32, 9.999999e96DL, 0)
20 CONVERT (111, d128, d32, 10.000000e96DL, FE_INEXACT)
21 CONVERT (112, d128, d32, 1.1111111DL, FE_INEXACT)
22 CONVERT (120, d128, d64, 9.999999999999999E384DL, 0)
23 CONVERT (121, d128, d64, 10.00000000000000E384DL, FE_INEXACT)
24 CONVERT (122, d128, d64, 1.1111111111111111DL, FE_INEXACT)
25
26 int
27 main ()
28 {
29   convert_100 ();
30   convert_101 ();
31   convert_102 ();
32   convert_110 ();
33   convert_111 ();
34   convert_112 ();
35   convert_120 ();
36   convert_121 ();
37   convert_122 ();
38
39   if (failcnt != 0)
40     abort ();
41   return 0;
42 }