Re: Standard Fortran Floating point behaviour
From: glen herrmannsfeldt (gah_at_ugcs.caltech.edu)
Date: 03/31/04
- Next message: Clive Page: "Re: Namelist I/O and direct access files"
- Previous message: Jin: "How to compile and link FFTW3 in fortran 77?"
- Next in thread: Gerry Thomas: "Re: Standard Fortran Floating point behaviour"
- Maybe reply: Gerry Thomas: "Re: Standard Fortran Floating point behaviour"
- Maybe reply: Eric K.: "Re: Standard Fortran Floating point behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Mar 2004 20:07:42 GMT
(previously snipped question about floating point equality comparison)
Dmitri Kavetski wrote:
> If the comparison is carried out in a register with higher precision then it
> is conceivable (?) that the value of A can get padded with additional
> nonzero digits and negate the comparison. So I would like to know if
> floating point standards prescribe any particular behaviour in this respect.
Well, the standard can guarantee all it wants to, but it
is the actual hardware that counts in the end.
If the hardware has operations that add non-zero digits then that
is what you will get. All hardware I know of extends with zeros.
The problems in Fortran occur when mixing precision and expecting
non-zero numbers to compare. 0.2 does not equal 0.2D0, and
because of rounding might not even when converted to single
precision.
There have been discussions about probabilistic rounding, which
might include random digits on extending numbers. Zero might be
a special case, though. If any hardware implemented that, it
might also implement interval comparison so that numbers would
compare equal when they were close enough.
-- glen
- Next message: Clive Page: "Re: Namelist I/O and direct access files"
- Previous message: Jin: "How to compile and link FFTW3 in fortran 77?"
- Next in thread: Gerry Thomas: "Re: Standard Fortran Floating point behaviour"
- Maybe reply: Gerry Thomas: "Re: Standard Fortran Floating point behaviour"
- Maybe reply: Eric K.: "Re: Standard Fortran Floating point behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|