Sample program: recursive Fibonacci function. identification division. program-id. pmain. environment division. configuration section. repository. function fib-func. data division. working-storage section. 01 n binary-char unsigned. procedure division. 100-main. move 8 to n display "fibonacci(",n,"): ",fib-func(n) *> Works for n<=8. move 9 to n display "fibonacci(",n,"): ",fib-func(n) *> Segfaults due to underflow in function. display fib-func(7) *> Also segfaults. Function cannot handle numeric...
I understand. Thank you both for the input.
So, suppose I want to save a FLOAT-LONG to a file. Since COBOL does not support moving 64-bit floats to strings directly, I'd need to move them to an edited picture first. However, GNUCobol 3.2.0 does not allow me to use the 'E' character. Consider the sample program below: identification division. program-id. sample. data division. working-storage section. 01 n float-long. 01 numeric-edited-1 pic -9(15).9(15) . *> 01 numeric-edited-2 pic -9(1).9(15)E-99. procedure division. 100-main. move 3.4587124e-60...
So, suppose I want to save a FLOAT-LONG to a file. Since COBOL does not support moving 64-bit floats to strings directly, I'd need to move them to an edited picture first. However, GNUCobol 3.2.0 does not allow me to use the 'E' character. Consider the sample program below: identification division. program-id. sample. data division. working-storage section. 01 n float-long. 01 numeric-edited-1 pic -9(15).9(15) . *> 01 numeric-edited-2 pic -9(1).9(15)E-99. procedure division. 100-main. move 3.4587124e-60...