Path: csiph.com!news.mixmin.net!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: Thu, 07 Oct 2021 07:51:03 -0700 Organization: None to speak of Lines: 43 Message-ID: <87czog7uso.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="0101718fcd2a42c8d4c22baec500ecab"; logging-data="11727"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+ZACt509IKwMeBhHvx2hN" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:iurxdBqQqWnx7AiAflpuKTx86fI= sha1:JkLBCv9DWxSkMPHRvdBRY3EmpAQ= Xref: csiph.com comp.std.c:6336 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.) -- 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 */