[Cfp-interest 2748] macros like DBL_MAX and FLT_EVAL_METHOD
Vincent Lefevre
vincent at vinc17.net
Tue Apr 4 05:28:31 PDT 2023
The N3096 5.2.4.2.2p29 example says:
The following describes floating-point representations that also
meet the requirements for single-precision and double-precision
numbers in IEC 60559,29) and the appropriate values in a <float.h>
header for types float and double:
[...]
DBL_MAX 1.7976931348623157E+308 // decimal constant
But p19 says for FLT_EVAL_METHOD = 2: "evaluate all operations and
constants to the range and precision of the long double type."
Note the "and constants". So this seems wrong if FLT_EVAL_METHOD = 2.
And even
((double) 1.7976931348623157E+308)
may not be correct, since if the FP_CONTRACT pragma is ON,
(long double) DBL_MAX might not give the expected value.
--
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