Phil Carmody <(EMail Removed)> writes:
> Tim Rentsch <(EMail Removed)> writes:
>
>> Ralf Damaschke <(EMail Removed)> writes:
>>
>> > Tim Rentsch <(EMail Removed)> wrote:
>> >
>> >> I believe it is possible in principle for 0.0 to be seen as
>> >> true (that is, != 0) in a conforming implementation, if that
>> >> implementation (a) does not have an exact FP representation for
>> >> zero, and (b) has implementationdefined rounding rules which
>> >> are defined suitably. AFAIK both (a) and (b) may be true in a
>> >> conforming implementation, that is, I don't know of any
>> >> requirement that prevents the possibility of either (or of both
>> >> together).
>> >
>> > There is one. An implementation (a) would not suffice C99 5.2.4.2.2
>> > "Characteristics of floating types <float.h>"; esp. the sum used to
>> > define a floatingpoint number gives 0 if f(k) = 0 for all
>> > 1 <= k <= p.
>>
>> If you read the footnote to 5.2.4.2.2 p1, and also 5.2.4.2.2 p3,
>> I think you'll agree that the condition you describe need not
>> be an actual representable value in a particular conforming
>> implementation. The value does exist in the model, but the
>> model may not reflect what the implementation actually uses,
>> and even if it does, the implementation might not provide FP
>> numbers with f(1) == 0. Needless to say, I did consult this
>> section (and these paragraphs) before making my earlier
>> comments. So I still think it's possible for an implementation
>> to not have zero as a representable FP value.
>
> I don't see how there can be any meaningful values for 5.2.4.2.2 p13
> if zero is nonzero.
I don't see what you're getting at here. Taking 'double' as
the canonical floatingpoint type, are you talking about
DBL_EPSILON, DBL_MIN, or DBL_TRUE_MIN? I don't see any
problem with any one of these, under a working assumption of
no reprsentation for zero. What am I missing?
> Zero must be less than epsilon, as epsilon must
> be greater than it.
Certainly zero must be less than any positive number. That
doesn't mean zero is representable.
> And zero must me expressible.
Isn't that exactly the question we are trying to answer, ie,
whether floating point types must have a representation for
zero? I don't see that the Standard's requirements imply
that.
> And zero must compare equal to negative zero. That can only be true
> if zero is zero.
Yes, if there is a zero, and if there is a negative zero. I
think the Standard is pretty clear that an implementation
need not have a floatingpoint negative zero.
> Anyway, logic aside, in this particular case does F.1 apply?
> """
> An implementation that de#nes _ _STDC_IEC_559_ _ shall conform to the
> speci#cations in this annex.
> """
> Which, if it applies, makes them bang to rights.
I'm pretty sure you're right that supprting IEEE floatingpoint
means there will be a representation for zero. In fact I would be
surprised (though not astonized) if any actual implementation
didn't have a floatingpoint representation for zero. My question
is, do the Standard's requirements imply that the floatingpoint
types /must/ have a representation for zero? So far I still think
the answer is no (at least in the hypothetical world of DS9000's,
etc).
