1 /* { dg-options "-std=gnu99 -O0" } */
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). */
9 extern void abort (void);
13 extern int printf (const char *, ...);
14 #define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
16 #define FAILURE abort ();
19 volatile _Decimal32 d32;
20 volatile _Decimal64 d64;
21 volatile _Decimal128 d128;
23 volatile unsigned int ui;
24 volatile long long sll;
25 volatile unsigned long long ull;
30 /* _Decimal32 to int. */
39 if (si != -2147483000)
42 /* _Decimal32 to unsigned int. */
46 if (ui != 4294967000U)
49 /* _Decimal32 to long long. */
53 if (sll != 9223372000000000000LL)
58 if (sll != -9223372000000000000LL)
61 /* _Decimal32 to unsigned long long. */
65 if (ull != 18446740000000000000ULL)
68 /* _Decimal64 to int. */
70 d64 = 2.147483647E9DD;
77 if (si != -2147483648)
80 /* _Decimal64 to unsigned int. */
82 d64 = 42949.67295E5DD;
87 /* _Decimal64 to long long. */
89 d64 = 9.223372036854775E18DD;
91 if (sll != 9223372036854775000LL)
94 d64 = -92233720.36854775E11DD;
96 if (sll != -9223372036854775000LL)
99 /* _Decimal64 to unsigned long long. */
100 d64 = 1844674407370955.E4DD;
102 if (ull != 18446744073709550000ULL)
105 /* _Decimal128 to int. */
107 d128 = 2.147483647E9DL;
109 if (si != 2147483647)
112 d128 = -2147483648.DL;
114 if (si != -2147483648)
117 /* _Decimal128 to unsigned int. */
119 d128 = 4294.967295E6DL;
121 if (ui != 4294967295)
124 /* _Decimal128 to long long. */
126 d128 = 9223372036854775807.DL;
128 if (sll != 9223372036854775807LL)
131 d128 = -9.223372036854775808E19DL;
133 if (sll != -9223372036854775807LL - 1LL)
136 /* _Decimal128 to unsigned long long. */
137 d128 = 18446744073709551615.DL;
139 if (ull != 18446744073709551615ULL)
146 /* This test assumes 32-bit int and 64-bit long long. */
148 if (sizeof (int) != 4 || sizeof (long long) != 8)