https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115164

            Bug ID: 115164
           Summary: floating-point output generates misleading values with
                    WriteFloat when sigfigs and width are zero
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

[Forwarded from the gm2 mailing list:
https://lists.nongnu.org/archive/html/gm2/2024-05/msg00009.html ]

For example if we use WriteFloat (pi, 0, 0) then the libraries issue a long
sequence of zeros once the precision runs out.  Consider the test code and
output below:

cat testwritereal.mod
MODULE testwritereal ;

FROM STextIO IMPORT WriteString, WriteLn ;
FROM SRealIO IMPORT WriteFloat ;
FROM RealMath IMPORT pi ;

BEGIN
   WriteString ('value of pi = ') ; WriteFloat (pi, 0, 0) ; WriteLn
END testwritereal.

$ gm2 testwritereal.mod
$ ./a.out 
value of pi =
31415926535897931159979634685441851615905761718750000000000000000000000000000000000000000000000000000

Reply via email to