[Cfp-interest 1550] AI to update note about INFINITY and NAN macros and _Float16

Jim Thomas jaswthomas at sbcglobal.net
Fri Mar 20 16:04:13 PDT 2020


Action item:
>     Jim: Add in a note to CFP 1526 to say the cast raises no floating point exceptions.
> 

Here’s the updated note:

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. This cast raises no floating-point exception.


- JIm Thomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20200320/acae94de/attachment-0001.html 


More information about the Cfp-interest mailing list