[Cfp-interest 1526] AI about INFINITY and NAN macros and _Float16
Jim Thomas
jaswthomas at sbcglobal.net
Wed Mar 4 11:23:22 PST 2020
Action item:
> Jim: Write a note for _Float16 getting infinity as a _Float16 type in Part 3 as an annex.
Here’s a draft:
In the subclause for <math.h> macros, add:
NOTE Because the INFINITY and NAN macros have type float, they can be used in a type-generic way and are converted, without raising a floating-point exception, to an infinity and a quiet NaN in the floating type determined by the context, provided that type is at least as wide as float. However, combined with operands only of type _Float16, the macros cause the semantic type of the expression to be float instead of _Float16. For example, if x has type _Float16, the expression x + INFINITY has semantic type float. If the narrower _Float16 type is desired, the macro should be cast to _Float_16: x + (_Float16)INFINITY.
- JIm Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20200304/0f0109cd/attachment-0001.html
More information about the Cfp-interest
mailing list