2 /* { dg-options "-O3" } */
4 /* N1150 5.3 Conversions between decimal floating and complex.
5 C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */
7 extern void abort(void);
10 /* Support compiling the test to report individual failures; default is
11 to abort as soon as a check fails. */
14 #define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
16 #define FAILURE abort ();
24 _Complex long double cld;
30 cf = 2.0f * __extension__ 1i + 3.0f;
31 cd = 2.0 * __extension__ 1i + 3.0;
32 cld = 2.0l * __extension__ 1i + 3.0l;
34 /* Convert complex to decimal floating. */
46 /* Convert decimal floating to complex. */
55 /* N1107 5.3 Conversions between decimal floating and complex.
56 When a value of decimal floating type converted to a complex
57 type, the real part of the complex result value is undermined
58 by the rules of conversions in N1107 5.2 and the imaginary part
59 of the complex result value is zero. */
61 if (__real__ cf != 2.5f)
63 if (__real__ cd !=1.5)
65 if (__real__ cld != 2.5)
67 if (__imag__ cf != 0.0f)
69 if (__imag__ cd != 0.0)
71 if (__imag__ cld != 0.0l)
74 /* Verify that the conversions from DFP types to complex is
75 determined by the rules of conversion to the real part. */
77 /* Convert _Decimal64 to _Complex float. */
80 if (__real__ cf != 0.125f)
82 /* Convert _Decimal128 to _Complex double. */
85 if (__real__ cd != 1.25E-7)
88 /* Verify that conversion from complex to decimal floating types
89 results in the value of the real part converted to the result
90 type according to the rules of conversion between those types. */
92 /* Convert _Complex float to decimal float types. */
93 cf = 2.0f * __extension__ 1i + 2.25f;
104 /* Convert _Complex double to decimal float types. */
105 cd = 2.0 * __extension__ 1i + 1.25;
116 /* Convert _Complex long double to decimal float types. */
117 cld = 2.0l * __extension__ 1i + 0.0625l;
125 if (d128 != 0.0625DL)