comparison gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-options "-O2" } */
2
3 /* N1150 5.2 Conversions among decimal floating types and between
4 decimal floating types and generic floating types.
5 C99 6.3.1.5(3) New. */
6
7 #include "dfp-dbg.h"
8
9 extern void link_error ();
10
11 int
12 main ()
13 {
14 _Decimal32 d32;
15 _Decimal64 d64;
16 _Decimal128 d128;
17
18 /* Conversions to larger types. */
19 d32 = 123.4df;
20 d64 = d32;
21 if (d64 != 123.4dd)
22 link_error ();
23 d128 = d32;
24 if (d128 != 123.4dl)
25 link_error ();
26 d64 = 345.678dd;
27 d128 = d64;
28 if (d128 != 345.678dl)
29 link_error ();
30
31 /* Conversions to smaller types for which the value fits. */
32 d64 = 3456.789dd;
33 d32 = d64;
34 if (d32 != 3456.789df)
35 link_error ();
36 d128 = 123.4567dl;
37 d32 = d128;
38 if (d32 != 123.4567dl)
39 link_error ();
40
41 d128 = 1234567890.123456dl;
42 d64 = d128;
43 if (d64 != 1234567890.123456dd)
44 link_error ();
45
46 return 0;
47 }