Re: Float comparison
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Mon, 18 May 2009 17:21:34 -0400
Flash Gordon wrote:
CBFalconer wrote:
Flash Gordon wrote:
.... snip ...
nextafter does not defined what you mean by your ranges. I am
trying to get an exact definition of them. Saying nextafter()
resolves the confusion is of no help because the standard does
not say:
No, but it provides another means of discovering the 'range'.
What I mean by that 'range' of x is those real number values
that, when stored in a fp-object, will result in a stored value
exactly equal to x.
OK, so given the C line
double x = some_constant_expressions;
If the result is that x contains the exact floating point value
1.0, then some_constant_expression is in the range for 1.0.
If it sets x to the value nextafter(1.0,2.0) then it is in the
next range up.
Is this correct? If so then I can ask me next question...
yes, correct.
.... snip ...
The critical thing is the variation in the significand of the fp
value, provided the exponent remains unchanged (normalized).
C allows for unnormalised numbers, so any model which claims to
allow for all valid C implementations (and even be what the
standard means) MUST allow foe unnormalised numbers.
C only allows for them for values smaller than the smallest
possible normalized value. So this problem is normally out of the
way. In effect the 'ranges' for the unnormalized small numbers are
much wider (in relation to the number) than any other ranges. I am
speaking of the usual fp-system which normalizes everything in
order to increase the accuracy by the one saved bit in the
significand.
You can see this easily in hex dumps of the fp-object.
(** was discussing the actual ranges **)
Irrelevant.
But handy, because you can see what causes the 'range' directly.
The point of the 'range' is that it defines the inherent error
levels due to the storage format.
Limitations are not necessarily errors. The storage format can be used
with absolutely no error under the right conditions. These are
conditions which *are* met by some applications written in C.
Now you are bringing in the programming. Certainly you CAN do
such. I am talking about what you can deduce from the fp-object
alone.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
.
- Follow-Ups:
- Re: Float comparison
- From: Flash Gordon
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- References:
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Flash Gordon
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Flash Gordon
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Flash Gordon
- Re: Float comparison
- From: CBFalconer
- Re: Float comparison
- From: Flash Gordon
- Re: Float comparison
- Prev by Date: Re: struct padding
- Next by Date: Re: Microsoft and memcpy?
- Previous by thread: Re: Float comparison
- Next by thread: Re: Float comparison
- Index(es):
Relevant Pages
|