CBFalconer said:
Keith Thompson wrote: [...]
We weren't talking about measurements. We were talking about stored
floating-point values. For example, 95.0 and 95.000 are exactly the
same value in C, and may or may not be the result of any measurement.
A given stored floating-point value might have some error range
associated with it, but the floating-point types themselves are
not capable of representing such an error range.
Right there is our fundamental disagreement.
I agree with that statement. It's also your fundamental disagreement
with the clear wording of the standard.
FP objects can only
store discrete values, with defined intervals between the available
values.
Correct! Dare I hope that you might be beginning to see my point?
Thus you can never tell which value in that range was
stored, without detailed knowledge of the associated code.
No, you can tell exactly what value was stored. I am frankly
astonished by your persistence in ignoring C99 6.2.4p2:
An object exists, has a constant address, *and retains its
last-stored value* throughout its lifetime.
(Emphasis added.)
For example, given:
double d;
d = 1.0/3.0;
the value stored (on my system) is exactly
0.333333333333333314829616256247390992939472198486328125
No more, no less. How do I know? I printed it with printf().
The mathemetical value 1.0/3.0 was *never stored* in d, because that
value *cannot* be stored in an object of type double (on my system,
and probably on yours).
I think you're claiming that the mathematical value 1.0/3.0 was
somehow stored in d, but that d doesn't retain that value. That is
directly contradicted by 6.2.4p2.
The
ranges are inherent in the storage mechanism, and their sizes are
represented by the various x_EPSILON values.
No, the *storage* mechanism simply stores one of the finitely many
representable values for the type in an object of that type. Errors
(i.e., discrepancies between representable FP values and mathematical
real values) may occur during computations, *not* when a result is
stored. (Even if intermediate expressions are computed in greater
precision, the conversion from the greater precision to the object's
type is just another computation.)