> Section 8.3.3.3 of the ISO spec defines both fixed- and floating-point
> numeric literals.
>
> "A fixed-point numeric literal is a character-string whose
> characters are selected from the digits '0' through '9', the plus
> sign, the minus sign, and the decimal point. The implementor shall
> allow for fixed-point numeric literals of 1 through 31 digits in
> length."
>
> "A floating-point numeric literal is signified by an 'E' between two
> fixed-point literals, where the exponent may have no more than 4
> digits, and no decimal point."
>
> What exactly that implies for constant compile-time expressions, now
> that fixed-point computation is available, I'm not sure.  I just want
> to clarify what ISO says, to avoid any confusion.


There are more rules for compile-time arithmetic expressions (7.3.6 7.3.8).
Most important "compile-time arithmetic expressions" in COBOL is _only_ referenced to in the compiler directives (=that is not related to constant-folding or similar)

> 1) Compile-time arithmetic expressions shall be formed in accordance with 8.8.1, Arithmetic expressions, with the following
> exceptions:
>   a) The exponentiation operator shall not be specified.
>   b) All operands shall be fixed-point numeric literals or arithmetic
>      expressions in which all operands are fixed-point numeric
       literals.
>   c) The expression shall be specified in such a way that a division
>      by zero cannot occur.
>
> 2) The implementor shall define and document any rules restricting the
>    precision and/or magnitude and/or range of permissible values for
>    the intermediate results needed to evaluate the arithmetic
>    expression. They shall also document which intermediate rounding
>    method is used, if applicable.

so for the compiling directing facility (CDF) there is no floating-point at all and you can just decide (as long as it is documented) the precision / rounding [or truncation] that applies.



For any "constant expressions" that you find in the real "code" - they have to work per the program specific rules (default, that the user may override).

Simon

Reply via email to