You have deleted material at this point without marking it implying that
the only comment I made was the one below.
You have deleted material posted by me below this point implying that I
did not write anything else.
Deleting the material showing your other errors without marking it is
not considered acceptable by the references on nettiquette you yourself
often quote, and it is also something you have recently denied doing.
No, you don't, not without looking at the programming that did the
store.
The C STANDARD states otherwise. Keith has already quoted the relevant
paragraphs in several posts over the past few days.
I think there is no argument that the precise value stored
in a FP object is a real.
It is a real in the same sense that the value stored in an int is a
real. If you exclude NaNs and infinities it is a member of a finite
subset of the rationals, which in turn is a subset of the reals.
Now quote the section of the C standard that states that floating point
numbers are reals (or ranges of reals). Not a statement by you that they
cannot be anything else, but a direct quote from the standard.
So is the value stored in the adjacent
object (i.e. the closest one numerically which exhibits a
difference via the '<' and '>' operators).
See above.
It is also a well known
fact that between any two different reals you can find an infinity
of other real values.
Yes, which are not in the set of values making up the floating point
numbers.
So I claim it is highly unlikely that you
can tell the exact value stored in that object.
Yes I can, I just read it out.
Remember, any
value in that infinity of values will result in the identical
construction of the FP object.
No, there are an infinite number of *reals*, there are exactly NO
floating point numbers between them.
I think the problem is that you insist on thinking of floating point
numbers as being reals. They are not reals, they are fundamentally
different to reals. Here are some of the differences:
1) Reals don't have NaNs, most floating point representations do
2) Reals don't have infinities, most floating point representations do
3) Reals don't have an upper or lower bound, floating point numbers do
4) There are an infinite number of reals between any two reals. There
are only a finite number (sometimes 0) of floating point numbers between
any two floating point numbers
5) With floating point numbers you sometimes have (a+b)+c != a+(b+c)
Now, so you can address the material you snipped without marking (or at
least appologise for snipping it without marking, here is the full
article including the material you deleted without any indication of
having done so.
---------------
CBFalconer said:
>>> Flash Gordon wrote:
>>>> Keith Thompson wrote:
>>>>>
>>> ... snip ...
>>>
>>>>>> So what? doubles are used to store reals, more or less. ints
>>>>>> are used to store integers. 1.0+DBL_EPSILON/2.0 is a real[1].
>>>>>> 1.5 is NOT an integer.
>>>>>>
>>>>>> [1] but not a storable real, in a double.
>>>>> It's that "more or less" that bites you, isn't it? Your model
>>>>> makes some sense if you ignore those pesky details where it
>>>>> falls apart.
>>>> <snip>
>>>>
>>>> In addition doubles *are* used to store exact integral values
>>>> and integer types *are* used to store approximations. Any claim
>>>> that you have stored a range when you have in fact stored the
>>>> exact value that you intended to store is clearly wrong and would
>>>> make error analysis impossible.
>>> So what? You are referring to the programming that is using that
>>> object. I am talking about what you can deduce from the object in
>>> isolation.
>> That value is. The point is, that taken in isolation you do NOT know
>> that it is a range. Taken in isolation you only know what the actual
>> stored value is. is a single exact value specified by a well-defined
>> model which may represent either an exact quantity or a range which
>> could be (and ofen is) far larger than the ranges you are talking about.
>>
>> The standard actually talks about values that "can be represented
>> exactly" in section 6.3.1.5 (paragraph 2).
>
> Yes, but that is simply a number.
Yes, which is all that is actually stored.
> You do know what the 'range'
> is. The number does not express the range of numbers that will be
> stored with that identical value, and simply cannot be told apart. In
isolation what you know is the range of values that can have
> been represented thusly.
In isolation you know exactly what value *has* been stored, you just
can't tell whether the programmer intended to store a value that cannot
be represented.
> ... snip ...
>
> Go forth and implement a FP system.
I've implemented FP arithmetic (sufficient to solve my problem, not a
full system) in assembler already thanks. The data fed in to it was
exact values, the data extracted from it and finally converted to
integers was exact values. The intervening calculations were
approximations which gave a known acceptable limit on the error of the
settings given to the hardware when compared to the theoretical
mathematical values the algorithm I had to implement an approximation of.
Now address the point that your claim is in direct contradiction to the
wording of the standard.
You have yet to address how float can be a subset of double if the items
in the two sets are fundamentally different (i.e. if the range about 1.0
for the closest approximation to 1.0 is different in the two sets).
> Then examine when and how it
> fails.
It did not fail because I understood exactly what was needed and
carefully worked through it to ensure that the errors and approximations
stayed within acceptable limits.
> You will soon appreciate the fundamental truths about such
> a system. You will soon see how all values (apart from zero, NaNs,
> Infs) are approximations, and how they cannot overlap.
If you think that zero is exact then you are being inconsistent.
Calculations (including the conversion of a floating point number in the
source code) can yield 0 when the "correct" value is non-zero but
smaller than the smallest number representable in the floating point system.
> One point
> is that taking a value and writing it down does NOT convert it from
> an approximation to something exact.
No, nor does it convert something exact in to an approximation.
Note that no one has claimed that any type in C can store exactly all
rationals within any given range.