public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
Date: Thu, 24 Jan 2008 15:09:00 -0000	[thread overview]
Message-ID: <20080124140115.18657.qmail@sourceware.org> (raw)
In-Reply-To: <bug-24685-8500@http.gcc.gnu.org/bugzilla/>



------- Comment #28 from dominiq at lps dot ens dot fr  2008-01-24 14:01 -------
Some remarks from powerpc-apple-darwin9:

(1) the title is misleading: formatted inputs are not broken, formatted outputs
are.

(2) they seem broken for constants nearest from bellow any power of two, as
shown by the following code:

[karma] bug/real16% cat real_16_red.f90
real(16) :: x
x = 1.0_16
print *, nearest(x,-x), nearest(x,x)
print *, nearest(1.0_16,-1.0_16), nearest(1.0_16,1.0_16)
end
[karma] bug/real16% gfc -fno-range-check real_16_red.f90
[karma] bug/real16% a.out 
  0.99999999999999999999999999999998767        
1.0000000000000000000000000000000247      
  1.00000000000000000000000000000000000       
1.00000000000000000000000000000002465      

where  nearest(1.0_16,-1.0_16) is ouput as 1.0...0 and not as 0.9...98767.

(3) As huge(1.0_16) is treated as a constant, I had to pay hide-and-seek with
gfortran in the following code:

[karma] bug/real16% cat huge_16.f90
character(80) :: tmp
real(16) :: x, y
x = 2.0_16**1022
print *, 2.0_16*x, 2.0_16*x-huge(x) ! 2.0_16**1023 is larger than huge(x) but
not printed as +Inf
y = nearest(4.0_16*x,-x)
print *, 4.0_16*x, nearest(2.0_16*x,x), nearest(y,-x)

x = nearest(2.0_16*x,-x)   ! hide huge in a variable
print *, x, x-huge(x)

write(tmp,*) x
read(tmp,*) y
print *, x, y, x-y        ! the printed value of y is not the same the one for
x

x = nearest(x,1.0_16)
print *, x, nearest(x,1.0_16)

print *, 8.98846567431157953864652595394512367E+0307_16
end
[karma] bug/real16% gfc -fno-range-check huge_16.f90
[karma] bug/real16% a.out
  8.98846567431157953864652595394512367E+0307 
1.10791393256022264271830208461724263E+0276
                                    +Infinity 
8.98846567431157953864652595394534525E+0307                                   
+Infinity
  8.98846567431157953864652595394501288E+0307  
0.0000000000000000000000000000000000      
  8.98846567431157953864652595394501288E+0307 
8.98846567431157953864652595394512367E+0307  
0.0000000000000000000000000000000000      
  8.98846567431157953864652595394512367E+0307 
8.98846567431157953864652595394534525E+0307
                                    +Infinity

where x is an hidden huge(x), correctly printed as
8.98846567431157953864652595394501288E+0307, correctly read as y (x-y==0.0),
while y is printed as 8.98846567431157953864652595394534525E+0307==+Inf.

Note also several value above huge(x) not printed as +Inf.


-- 


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


  parent reply	other threads:[~2008-01-24 14:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-05 19:34 [Bug libfortran/24685] New: real(10) formatted input is broken for huge values jblomqvi at cc dot hut dot fi
2005-11-05 23:24 ` [Bug libfortran/24685] " fxcoudert at gcc dot gnu dot org
2006-02-05 22:20 ` [Bug libfortran/24685] [4.1 only] " fxcoudert at gcc dot gnu dot org
2006-02-05 23:04 ` fxcoudert at gcc dot gnu dot org
2006-02-14 15:48 ` fxcoudert at gcc dot gnu dot org
2006-02-14 15:50 ` fxcoudert at gcc dot gnu dot org
2006-02-16 10:55 ` ebotcazou at gcc dot gnu dot org
2006-02-16 11:12 ` [Bug libfortran/24685] real(16) " fxcoudert at gcc dot gnu dot org
2006-02-16 17:44 ` pinskia at gcc dot gnu dot org
2006-02-23 17:44 ` sje at cup dot hp dot com
2006-03-15  7:29 ` ebotcazou at gcc dot gnu dot org
2006-03-15 16:22 ` jb at gcc dot gnu dot org
2006-03-15 16:44 ` sje at cup dot hp dot com
2006-03-16  8:30 ` jb at gcc dot gnu dot org
2006-04-01 21:34 ` ebotcazou at gcc dot gnu dot org
2006-04-01 21:35 ` ebotcazou at gcc dot gnu dot org
2006-04-10 12:03 ` jakub at gcc dot gnu dot org
2006-04-21 17:04 ` jakub at gcc dot gnu dot org
2006-04-21 17:22 ` jakub at gcc dot gnu dot org
2006-05-24 18:58 ` fxcoudert at gcc dot gnu dot org
2006-05-24 19:01   ` Andrew Pinski
2006-05-24 19:01 ` pinskia at physics dot uc dot edu
2006-05-24 20:35 ` fxcoudert at gcc dot gnu dot org
2007-05-25 19:50 ` jvdelisle at gcc dot gnu dot org
2007-05-26 17:51 ` dominiq at lps dot ens dot fr
2007-11-03 16:48 ` jvdelisle at gcc dot gnu dot org
2007-11-12  5:44 ` jvdelisle at gcc dot gnu dot org
2008-01-17 11:24 ` [Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90) burnus at gcc dot gnu dot org
2008-01-17 15:33 ` ebotcazou at gcc dot gnu dot org
2008-01-24 15:09 ` dominiq at lps dot ens dot fr [this message]
2008-01-25 15:47 ` dominiq at lps dot ens dot fr
2008-02-23 20:11 ` fxcoudert at gcc dot gnu dot org
2008-02-23 20:11 ` fxcoudert at gcc dot gnu dot org
2008-02-28  7:10 ` uros at gcc dot gnu dot org
2008-12-12 22:20 ` janis at gcc dot gnu dot org
2008-12-12 22:23 ` janis at gcc dot gnu dot org
2008-12-19  1:39 ` howarth at nitro dot med dot uc dot edu
2008-12-19 17:51 ` janis at gcc dot gnu dot org
2008-12-19 18:15 ` janis at gcc dot gnu dot org
2008-12-19 18:23 ` janis 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=20080124140115.18657.qmail@sourceware.org \
    --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).