Path: csiph.com!weretis.net!feeder8.news.weretis.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: Fri, 01 Oct 2021 12:20:06 -0700 Organization: None to speak of Lines: 33 Message-ID: <877dewimc9.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="13acd1fe4bff95bcb7ffb2395063c869"; logging-data="10779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MCjsVdzjSvPk+wuOOPsvS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:S2Rwa4l0n5gCUg4tMczRZf2JA5M= sha1:PchTualhAKmyjeJ51csRYFd5KRc= Xref: csiph.com comp.std.c:6327 Vincent Lefevre writes: > In article <87lf3ehy4v.fsf@nosuchdomain.example.com>, [...] > Shouldn't the standard by changed to make INFINITY conditionally > defined (if not required to expand to a true infinity)? > This should not break existing programs. I agree. NAN is conditionally defined "if and only if the implementation supports quiet NaNs for the float type". I have no idea why the same wasn't done for INFINITY -- unless, as I mentioned upthread, there was existing practice. INFINITY was introduced in C99. Perhaps there were pre-C99 implementations that defined INFINITY as an extension in the way that's now specified in the standard. That's just speculation, and I still think making it conditional would have made more sense. [...] > 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. (The Alpha supports both VAX and IEEE floating-point, and I don't think VAX FP supports infinities or NaNs, but I don't think an implementation would use, for example, VAX FP for float and IEEE for double.) -- 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 */