Strange run-time error message for "too many digits" in floating point number
Trying to see floating point numbers rounded, I just threw a lot of digits at it. However, with 40 digits, this generates a strange run-time error, which 38 does not. (Although, the 38 digits are replicated without rounding error... probably because it isn't a fp number at all, but an int128.)
On the other hand, the GNU Cobol error message is also quite un-expected. A quick check of IBM manuals show no obvious limit at 38 digits in a fp constant...
IDENTIFICATION DIVISION.
PROGRAM-ID. bug-display1.
PROCEDURE DIVISION.
DISPLAY 3.141592653589793238462643383279502884197
STOP RUN.
$ make bug-display1
gcobol -g -O3 -o bug-display1 -static bug-display1.cbl
$ ./bug-display1
Trying to raise 10 to 40 as an int128, which we can't do.
The problem is in __gg__power_of_ten.
Aborted
$
$ cobc -x bug-display1.cbl -o bug-display1
bug-display1.cbl:5: error: invalid numeric literal: '3141592653589793238462643383279502 ...'
bug-display1.cbl:5: error: literal length 40 exceeds maximum of 38 digits
$
Edited by Torbjörn Lindh