Re: Float comparison
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Wed, 06 May 2009 21:13:06 -0400
Keith Thompson wrote:
CBFalconer <cbfalconer@xxxxxxxxx> writes:
Richard Heathfield wrote:[...]
CBFalconer said:
<snip>
FP objects can only store discrete values, with defined
intervals between the available values. Thus you can never
tell which value in that range was stored,
There's your problem right there. You are confusing "value" and
"interpretation". The value that was stored is easy to discover,
simply by looking. What you meant when you stored it there is a
completely different matter.
Try thinking about it. For example, if I write:
float x = 1.0/3.0;
you are claiming the value stored is 1/3.
I don't believe anybody made such a claim. (It's possible only of
FLT_RADIX is a multiple of 3.)
Then you can't claim you know what is stored there. How the
floating arithmetic is implemented is not specified by the C
standard. All you KNOW is that the value stored is within a range
(my word) of the value read out of x later. Maybe the float system
always stores the input value multiplied by three? In that case
the stored value will be exactly 1.0/3.0, stored as a value of
<i.oo>, just to separate the FP and normal numbers. I believe such
a system is legitimate in C. I could probably implement it.
Relax, I won't.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
.
- Follow-Ups:
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: Richard Heathfield
- Re: Float comparison
- References:
- Re: Float comparison
- From: *** T. Winter
- Re: Float comparison
- From: Gordon Burditt
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Richard Heathfield
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- Prev by Date: Re: Float comparison
- Next by Date: Re: comare tow int
- Previous by thread: Re: Float comparison
- Next by thread: Re: Float comparison
- Index(es):