1 /* Check that appropriate exceptions are raised for int to DFP conversions. */
2
3 #include "fe-check.h"
4
5 volatile _Decimal32 d32;
6 volatile _Decimal64 d64;
7 volatile signed int si;
8 volatile unsigned int ui;
9 volatile signed long long sll;
10 volatile unsigned long long ull;
11
12 CONVERT (100, si, d32, 9999999, 0)
13 CONVERT (101, si, d32, 11111111, FE_INEXACT)
14 CONVERT (102, si, d32, -9999999, 0)
15 CONVERT (103, si, d32, -10000001, FE_INEXACT)
16 CONVERT (110, ui, d32, 9999999, 0)
17 CONVERT (111, ui, d32, 10000001, FE_INEXACT)
18 CONVERT (200, sll, d64, 9999999999999999, 0)
19 CONVERT (201, sll, d64, 10000000000000001, FE_INEXACT)
20 CONVERT (202, sll, d64, -9999999999999999, 0)
21 CONVERT (203, sll, d64, -10000000000000001, FE_INEXACT)
22 CONVERT (210, ull, d64, 9999999999999999, 0)
23 CONVERT (211, ull, d64, 10000000000000001, FE_INEXACT)
24
25 int
main()26 main ()
27 {
28 if (sizeof (long long) != 16)
29 return 0;
30
31 convert_100 ();
32 convert_101 ();
33 convert_102 ();
34 convert_103 ();
35 convert_110 ();
36 convert_111 ();
37 convert_200 ();
38 convert_201 ();
39 convert_202 ();
40 convert_203 ();
41 convert_210 ();
42 convert_211 ();
43
44 FINISH
45 }
46