1 /* C99 6.5.16 Assignment operators.
2 Verify the compound assignment operator for decimal float types,
3 using it with other decimal float types, integers, and other binary
4 float types cast to decimal float types. */
8 #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
9 if (( OPRD1 OPRT OPRD2 )!= RLT) \
12 #define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
14 _Decimal##TYPE d = OPRD; \
15 OPERATE(d,+=,1,(OPRD + 1)); \
17 OPERATE(d,+=,0,OPRD); \
19 OPERATE(d,+=,(-1),(OPRD - 1)); \
21 OPERATE(d,+=,d32a,(OPRD + d32a)); \
23 OPERATE(d,+=,d64a,(OPRD + d64a)); \
25 OPERATE(d,+=,d128a,(OPRD + d128a)); \
27 OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \
29 OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \
31 OPERATE(d,-=,1,(OPRD - 1)); \
33 OPERATE(d,-=,0,OPRD); \
35 OPERATE(d,-=,(-1),(OPRD + 1)); \
37 OPERATE(d,-=,d32a,OPRD-d32a); \
39 OPERATE(d,-=,d64a,OPRD-d64a); \
41 OPERATE(d,-=,d128a,OPRD-d128a); \
47 _Decimal32 d32
= 1.23456df
, d32a
= 1.2df
;
48 _Decimal64 d64
= 23.456789dd
, d64a
= 2.8dd
;
49 _Decimal128 d128
= 345.67890123456789dl
, d128a
= 4.7dl
;
51 DECIMAL_COMPOUND_ASSIGNMENT(32, d32
);
52 DECIMAL_COMPOUND_ASSIGNMENT(64, d64
);
53 DECIMAL_COMPOUND_ASSIGNMENT(128, d128
);