public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gaius at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug modula2/115164] New: floating-point output generates misleading values with WriteFloat when sigfigs and width are zero
Date: Mon, 20 May 2024 15:30:01 +0000	[thread overview]
Message-ID: <bug-115164-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2024-05-20 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 15:30 gaius at gcc dot gnu.org [this message]
2024-05-20 15:36 ` [Bug modula2/115164] " gaius at gcc dot gnu.org
2024-05-21  0:13 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115164-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).