public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "enrico dot segre at weizmann dot ac dot il" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/28354]  New: 0.99999 printed as 0. instead of 1. by format(f3.0)
Date: Wed, 12 Jul 2006 08:13:00 -0000	[thread overview]
Message-ID: <bug-28354-12939@http.gcc.gnu.org/bugzilla/> (raw)

Compiling the following snippet

       write(*,100) 0.99999
       write(*,100) 0.999999
       write(*,100) 0.9999999
       write(*,100) 0.99999999
       write(*,100) 0.999999999
       write(*,100) 0.9999999999
 100   format((f3.0))
       end

with gcc-gfortran-4.1.1-1.fc5, I get as output

   0.
   0.
   0.
   1.
   1.
   1.


I get similar faulty output with -0.9999..., but with no other number/format
combination I have tried.
I get normal output (i.e. all 1.) with other compilers on other machines, such
as gcc-g77-3.2.2-5 on i686; moreover (if that's relevant)

#include <stdio.h>
int main()
{
  printf("%3.0f\n",0.999);
  printf("%3.0f\n",0.9999);
  printf("%3.0f\n",0.99999);
  printf("%3.0f\n",0.999999);
  printf("%3.0f\n",0.9999999);
  printf("%3.0f\n",0.99999999);
}

gives all ones too, when compiled on the same machine with gcc-4.1.1-1.fc5


-- 
           Summary: 0.99999 printed as 0. instead of 1. by format(f3.0)
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: enrico dot segre at weizmann dot ac dot il
  GCC host triplet: i686


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28354


             reply	other threads:[~2006-07-12  8:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-12  8:13 enrico dot segre at weizmann dot ac dot il [this message]
2006-07-12  8:56 ` [Bug fortran/28354] " pinskia at gcc dot gnu dot org
2006-07-12 15:21 ` [Bug libfortran/28354] " fxcoudert at gcc dot gnu dot org
2006-08-21 11:26 ` fxcoudert at gcc dot gnu dot org
2006-08-22  0:25 ` jvdelisle at gcc dot gnu dot org
2006-08-28  5:14 ` jvdelisle at gcc dot gnu dot org
2006-08-28  5:17 ` jvdelisle at gcc dot gnu dot org
2006-08-28  5:18 ` [Bug libfortran/28354] [4.1 Only] " jvdelisle at gcc dot gnu dot org
2006-08-30 15:48 ` pinskia at gcc dot gnu dot org
2007-04-28 10:42 ` tbm at cyrius dot com
2007-04-28 15:31 ` jvdelisle at gcc dot gnu dot 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-28354-12939@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).