Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.std.c
Subject: Re: contradiction about the INFINITY macro
Date: Thu, 07 Oct 2021 07:05:35 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <861r4xq6a8.fsf@linuxsc.com>
References: <20210930012112$48d9@zira.vinc17.org> <87pmsqizrh.fsf@nosuchdomain.example.com> <20210930105413$d6e8@zira.vinc17.org> <87lf3ehy4v.fsf@nosuchdomain.example.com> <20211001083755$efb3@zira.vinc17.org> <877dewimc9.fsf@nosuchdomain.example.com> <20211004092110$b3e8@zira.vinc17.org> <87r1d0g0dh.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="9374937631a63b2b305129710c17edd9"; logging-data="31731"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yZsoi/BnF1LXmn9DSgA/0zF0nWm91fjc="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:0gtwFVHRqOaGd5xGXczt2vDDOsY= sha1:XXW5LSjvP7NG4FiWyC7+Wgd9k5A=
Xref: csiph.com comp.std.c:6335
Keith Thompson writes:
> Vincent Lefevre writes:
>
>> In article <877dewimc9.fsf@nosuchdomain.example.com>,
>> Keith Thompson wrote:
>>
>>> Vincent Lefevre writes:
>>>
>>>> In article <87lf3ehy4v.fsf@nosuchdomain.example.com>,
>>>> Even if FP_INFINITE could be defined conditionally, this would
>>>> not imply that INFINITY is usable, since for instance, long
>>>> double may have an infinity but not float.
>>>
>>> The standard only defines INFINITY and NAN for type float. I
>>> think the implication is that it assumes either all floating types
>>> have NaNs and/or infinities, or none do. That might be a valid
>>> assumption.
>>
>> But the standard doesn't say that explicitly. It even just says
>> "if and only if the implementation supports quiet NaNs for the
>> float type". If the intent were to have NaN support for all the
>> FP types or none, why doesn't it say "... for the floating types"
>> instead of "... for the float type"?
>
> Since the NAN macro is of type float (if it's define), it only makes
> sense to define it that way. Presumably if an implementation had
> NaN for float but not for double, it would define NAN.
If float has a NaN then so do double and long double, because of
6.2.5 paragraph 10. Similarly for infinity (or infinities).