In C23, floating-point literals (called "constants" there) can be represented with excess precision, meaning a float literal is treated as a double or long double value (without affecting the type system, though).
In C++, there is no such permission.
Both C++ and C permit floating-point computations (including operands) to use excess precision. A footnote hints that a conversion will drop the excess precision (e.g. (float)(314.f/100.f) yields a value with float precision) (like C does), but there is no normative wording to make that happen.
What is the design intent for handling excess-precision floating-point computations in C++?
See CWG2752 for details.
In C23, floating-point literals (called "constants" there) can be represented with excess precision, meaning a
floatliteral is treated as adoubleorlong doublevalue (without affecting the type system, though).In C++, there is no such permission.
Both C++ and C permit floating-point computations (including operands) to use excess precision. A footnote hints that a conversion will drop the excess precision (e.g.
(float)(314.f/100.f)yields a value withfloatprecision) (like C does), but there is no normative wording to make that happen.What is the design intent for handling excess-precision floating-point computations in C++?
See CWG2752 for details.