> -----Original Message-----
> From: Robert Dubner <rdub...@symas.com>
> Sent: Friday, March 21, 2025 14:23
> To: Richard Biener <rguent...@suse.de>
> Cc: gcc-patches@gcc.gnu.org; Jakub Jelinek <ja...@redhat.com>
> Subject: RE: [PATCH] change cbl_field_data_t::etc_t::value from
_Float128
> to tree
> 
> Crossed in the mail.
> 
> I applied your fixes below.
> 
> The output of the one-liner program is now 1.2345678E+07, as expected.
> 
> The .00 instead of .01 problem still exists; source code coming soon.

This program 

        IDENTIFICATION DIVISION.
        PROGRAM-ID.  numeds.
        DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 VARP9  PIC P9  VALUE 0.01.
        PROCEDURE DIVISION.
            DISPLAY "VARP9 should be .01"
            DISPLAY "VARP9        is " VARP9.
        END PROGRAM numeds.

generates

     VARP9 should be .01
     VARP9        is .00

As usual, it's COBOL, so it comes with a lecture:

The variable

        01 VARP9  PIC P9  VALUE 0.01.

means that it is a NUMERIC DISPLAY variable, which is represented in
memory as ASCII digits.  There is but one '9' in the PICTURE, so it is a
one-digit number.  The prefix 'P', in the "P9", means that the actual
value of the variable is scaled by 0.01  So, the value 0.01 is represented
in memory by a single "1".

If it were "PIC 9PPP", then 1,000 would be represented in memory as a
single "1".

Anyway, that's the story.

Reply via email to