[Cfp-interest 1240] C++ and floating point literals

Fred J. Tydeman tydeman at tybor.com
Sat Jan 26 07:07:57 PST 2019


On Thu, 24 Jan 2019 12:43:26 -0600 Rajan Bhakta wrote:
>
>    Ian: Find the C++ standard reference and macro name for their handling 
>of floating point literals. - See CFP1236, Done.

I am looking at  
  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/n4800.pdf
(the current working draft of C++ standard of 2019-01-21).

Clause 16.3.6 (header <cloat> synopsis) has:
The header <cfloat> defines all macros the same as the C standard library header <float.h>.

 FLT_EVAL_METHOD is one of those macros.  That is the only mention of FLT_EVAL_METHOD
in the C++ standard.

Clause 7.1 (expressions) has:  
6 The values of the floating operands and the results of floating expressions may be represented in greater
precision and range than that required by the type; the types are not changed thereby.53

53) The cast and assignment operators must still perform their specific conversions as described in 7.6.3, 7.6.1.8 and 7.6.18.


Clause 5.13.4 (floating literals) has:
If the scaled value is in the range of representable values
for its type, the result is the scaled value if representable, else the larger or smaller representable value nearest
the scaled value, chosen in an implementation-defined manner.


---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list