1 /* { dg-options "-O3" } */
3 /* N1150 5.3 Conversions between decimal floating and complex.
4 C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */
6 extern void abort(void);
9 /* Support compiling the test to report individual failures; default is
10 to abort as soon as a check fails. */
13 #define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
15 #define FAILURE abort ();
23 _Complex long double cld;
29 cf = 2.0f * __extension__ 1i + 3.0f;
30 cd = 2.0 * __extension__ 1i + 3.0;
31 cld = 2.0l * __extension__ 1i + 3.0l;
33 /* Convert complex to decimal floating. */
45 /* Convert decimal floating to complex. */
54 /* N1107 5.3 Conversions between decimal floating and complex.
55 When a value of decimal floating type converted to a complex
56 type, the real part of the complex result value is undermined
57 by the rules of conversions in N1107 5.2 and the imaginary part
58 of the complex result value is zero. */
60 if (__real__ cf != 2.5f)
62 if (__real__ cd !=1.5)
64 if (__real__ cld != 2.5)
66 if (__imag__ cf != 0.0f)
68 if (__imag__ cd != 0.0)
70 if (__imag__ cld != 0.0l)
73 /* Verify that the conversions from DFP types to complex is
74 determined by the rules of conversion to the real part. */
76 /* Convert _Decimal64 to _Complex float. */
79 if (__real__ cf != 0.125f)
81 /* Convert _Decimal128 to _Complex double. */
84 if (__real__ cd != 1.25E-7)
87 /* Verify that conversion from complex to decimal floating types
88 results in the value of the real part converted to the result
89 type according to the rules of conversion between those types. */
91 /* Convert _Complex float to decimal float types. */
92 cf = 2.0f * __extension__ 1i + 2.25f;
103 /* Convert _Complex double to decimal float types. */
104 cd = 2.0 * __extension__ 1i + 1.25;
115 /* Convert _Complex long double to decimal float types. */
116 cld = 2.0l * __extension__ 1i + 0.0625l;
124 if (d128 != 0.0625DL)