1 /* { dg-options "-O2 -w" } */
3 /* N1150 5.1 Conversions from decimal float to integer. */
5 /* Test decimal float to integer conversions for values at the limit of
6 what will fit into the destination type. This assumes 32-bit int and
7 64-bit long long (there's a check for that below). This version tests
8 conversions during compilation. */
12 extern void link_error (void);
23 unsigned long long ull;
25 /* _Decimal32 to int. */
34 if (si != -2147483000)
37 /* _Decimal32 to unsigned int. */
41 if (ui != 4294967000U)
44 /* _Decimal32 to long long. */
48 if (sll != 9223372000000000000LL)
53 if (sll != -9223372000000000000LL)
56 /* _Decimal32 to unsigned long long. */
60 if (ull != 18446740000000000000ULL)
63 /* _Decimal64 to int. */
65 d64 = 2.147483647E9DD;
72 if (si != -2147483648)
75 /* _Decimal64 to unsigned int. */
77 d64 = 42949.67295E5DD;
82 /* _Decimal64 to long long. */
84 d64 = 9.223372036854775E18DD;
86 if (sll != 9223372036854775000LL)
89 d64 = -92233720.36854775E11DD;
91 if (sll != -9223372036854775000LL)
94 /* _Decimal64 to unsigned long long. */
95 d64 = 1844674407370955.E4DD;
97 if (ull != 18446744073709550000ULL)
100 /* _Decimal128 to int. */
102 d128 = 2.147483647E9DL;
104 if (si != 2147483647)
107 d128 = -2147483648.DL;
109 if (si != -2147483648)
112 /* _Decimal128 to unsigned int. */
114 d128 = 4294.967295E6DL;
116 if (ui != 4294967295)
119 /* _Decimal128 to long long. */
121 d128 = 9223372036854775807.DL;
123 if (sll != 9223372036854775807LL)
126 d128 = -9.223372036854775808E19DL;
128 if (sll != -9223372036854775807LL - 1LL)
131 /* _Decimal128 to unsigned long long. */
132 d128 = 18446744073709551615.DL;
134 if (ull != 18446744073709551615ULL)
141 /* This test assumes 32-bit int and 64-bit long long. */
143 if (sizeof (int) != 4 || sizeof (long long) != 8)