Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.std.c Subject: Re: contradiction about the INFINITY macro Date: Fri, 08 Oct 2021 11:41:22 -0700 Organization: None to speak of Lines: 47 Message-ID: <874k9r7419.fsf@nosuchdomain.example.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> <861r4xq6a8.fsf@linuxsc.com> <87czog7uso.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="41139519b557a828e82b1a9dc12922fd"; logging-data="24327"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wY1OEU9sZljSR2oZHSYU3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:bVPzabiR22uh3rWo7Xh46UMU5UE= sha1:bYWA6v/0XQQ/OCkwUwq4wC9sTD0= Xref: csiph.com comp.std.c:6341 Keith Thompson writes: > Tim Rentsch writes: >> 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). > > Agreed. 6.2.5p10 says: > > There are three real floating types, designated as float, double, > and long double. The set of values of the type float is a subset of > the set of values of the type double; the set of values of the type > double is a subset of the set of values of the type long double. > > (No need to make everyone look it up.) I just noticed that leaves open the possibility, for example, that double supports infinity but float doesn't. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */