[Cfp-interest 2327] Re: infinity and exceptions
Vincent Lefevre
vincent at vinc17.net
Fri Jan 14 03:42:23 PST 2022
On 2022-01-13 21:06:35 -0800, Fred J. Tydeman wrote:
> On Fri, 14 Jan 2022 14:22:00 +1100 (AEDT) Damian McGuckin wrote:
> >
> >On Thu, 13 Jan 2022, Fred J. Tydeman wrote:
> >>How about adding to 5.2.4.2.2 #16 and #17:
> >>16: The evaluation of INFINITY does not raise any FP exceptions.
> >>17: The evaluation of NAN does not raise any FP exceptions.
OK for me.
> >Yes. But then again, how do you evaluate NAN?
Just like any expression.
> >You can assign it.
Other things can be done, not just assignments. Even
(void) NAN;
is an evaluation.
> I have been sent the output of a program that did
> float f;
> f = NAN;
> and the raised overflow, inexact, and invalid.
> My guess: It appears that NAN was defined as (INFINITY * 0.f)
> and INFINITY was defined as (LDBL_MAX * LDBL_MAX)
Indeed, that's incorrect, concerning the exceptions, but also
the values when rounding toward zero could be used (one would
get LDBL_MAX for INFINITY and 0 for NAN), and the types too.
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the Cfp-interest
mailing list