This is a follow-up to [bugs:#470] which showed that computations with ON SIZE ERROR are handled different than computations without - but this shouldn't be the case.
In general this is what should be done in this case:
use an intermediate decimal128 item for each part
if the result of an intermediate item would be farther from zero than is allowed: -9 999 999 999 999 999 999 999 999 999 999 999E+6144 and +9 999 999 999 999 999 999 999 999 999 999 999E+6144- the EC-SIZE-OVERFLOW exception condition is set to exist and the content of the resultant identifier is unchanged.
if the result of an intermediate item would be nearer to zero than is allowed: 1.0E-6176 and +1.0E-6175 - the INTERMEDIATE ROUNDING clause active should be checked:
PROHIBITED - EC-SIZE-TRUNCATION is set (further results undefined, I'd say: do rounding and further calculation)if the result of a receiving item would be nearer to zero than is allowed: 1.0E-6176 and +1.0E-6175
--> ideally depending on a compiler configuration flag:
--> configuration value1 (defined in COBOL 2014): the EC-SIZE-UNDERFLOW exception condition is set to exist and the content of the resultant identifier is unchanged
--> configuration value2 (defined in COBOL 2002 which doesn't has EC-SIZE-UNDERFLOW): the receiving item is set to the nearest possible zero value
if the receiving item is a FLOAT-DECIMAL-16 item the following additional rules exist
-9.999 999 999 999 99E+384 and +9.9999 999 999 999 999E+384- the EC-SIZE-OVERFLOW exception condition is set to exist and the content of the resultant identifier is unchanged.1.0E-398 and +1.0E-398EC-SIZE-UNDERFLOW exception condition is set to exist and the content of the resultant identifier is unchangedEC-SIZE-UNDERFLOW): the receiving item is set to the nearest possible zero valueIf any of the mentioned exceptions is set the statements in the ON SIZE ERROR phrase should be executed.
Considered to be fine in re-branch after Ron's changes, merged to trunk with [r2324]. We should add test cases for intermediate rounding options, but this can be done after the rc-1 (ideally before the final release).