* [Fwd: Formatted Read Accuracy]
@ 2002-10-09 11:34 Emil Block
2002-10-09 11:43 ` Eljay Love-Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Emil Block @ 2002-10-09 11:34 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: Type: message/rfc822, Size: 1095 bytes --]
From: Emil Block <blime@his.com>
To: kisa@centropolisfx.com
Subject: Re: Formatted Read Accuracy
Date: Wed, 09 Oct 2002 14:00:35 -0400
Message-ID: <3DA46EC3.F332AA1A@his.com>
Gokhan Kisacikoglu wrote:
>
> > input xllt is 67.9936 and it becomes 67.9935989
> >
>
> These happen because of floating point accuracy, it has nothing to do
> with the reader or your format statement. Certain numbers can not be
> accurately represented with float numbers (even with double
> precision)...
>
> Good luck,
> -kisa
I don't understand -- the numbers are correctly read with the F77 compiler
used on the same source code. This is only one example of hundreds of numbers
that are read and G77 adds change in the fifth thru seventh decimal places on
all of them.
Blime
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Fwd: Formatted Read Accuracy]
2002-10-09 11:34 [Fwd: Formatted Read Accuracy] Emil Block
@ 2002-10-09 11:43 ` Eljay Love-Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2002-10-09 11:43 UTC (permalink / raw)
To: Emil Block, gcc-help
Hi Blime,
Floating point numbers -- IEEE 754, 32-bit "float", 64-bit "double", or any
of the other more-or-less standard formats -- cannot perfectly represent
any arbitrary decimal portion of all rational numbers.
For instance, 0.5 can be perfectly represented.
Consider that "0.5" (decimal) is "0.8" (hexadecimal). Exactly.
0.1 cannot be perfectly represented.
Consider that "0.1" (decimal) would be
"0.1999999999999999999999999999999..." (hexadecimal). Since floating point
numbers do not have infinite precision, some rounding occurs.
To alleviate the problem, consider using fixed point numbers, or using BCD
numbers.
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-09 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09 11:34 [Fwd: Formatted Read Accuracy] Emil Block
2002-10-09 11:43 ` Eljay Love-Jensen
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).