On Thu, 18 May 2006, Roland Schilling wrote:
> On Thu, 18 May 2006, Harvey Richardson - Consultant Benchmark Engineer wrote:
>
> > I very much doubt if the standard says anything. You just
> > have floating-point representation errors and you could
> > get either result depending on the rounding. The 0.4 is
> > not going to be stored exactly.
>
> OK, but that is something I already had in mind. If I print
> the to values to be compared with the format f24.20 I get
> 4.00000000000000000000 4.00000000000000000000
> i.e. 20 zeros after the digital point!
>
> Roland
Modifying the program a bit (the equivalence was necessary to get g95 to
print in hexadecimal)
equivalence(ia,a), (ib,b), (ic,c)
logical al10b, alc
a=4.0
b=0.4
c=10.*b
alc = a<c
al10b = a < 10.*b
write(*,'(1x,2l1,3z9)') a < (10.*b), (a<c), ia, ib, ic
end
g95 -O0 gives TF TF 40800000 3ECCCCCD 40800000
g95 -O2 gives TF FF 40800000 3ECCCCCD 40800000
ifort gives FF FF 40800000 3ECCCCCD 40800000 (for -O0 and for -O2)
Curious!
Cheers, Wes
--
Dr. W. J. Metzger Experimental High Energy Physics Group
tel. +31-24-3653127 Faculty of Science
+31-24-3652099 (secr.) Radboud University Nijmegen (**)
fax. +31-24-3652191 Toernooiveld 1
6525 ED Nijmegen, The Netherlands
e-mail: [log in to unmask] or [log in to unmask]
http://home.cern.ch/metzger/ or http://www.hef.ru.nl/~wes
(**) On 1 Sept. 2004 the University of Nijmegen changed its name
|