std::numeric_limits<float>::max_digits10 value of 8 is wrong and should be 9.max_digits10 is the number of decimal digits that is required to ensure that a 1 least significant bit change in the floating point value produces a change in the decimal digits string representation.// See for details: http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdfThe long accepted formula for this was given by Kahan2 + std::numeric_limits<float>::digits * 3010/10000and for float this gives a value of 9.VC 10 returns only 8, and this is not sufficient for a significant number of float values.One example (and only one is necessary for the choice of 8 to be wrong, but about 1/3 show this problem)1.10000006e-032f or as a binary pattern in hex a647609 is displayed using max_digits 10 as1.1000001e-032but the next binary value, a64760a is also displayed as the *same* value 1.1000001e-032.Using the accepted value of 9 for max_digits10, a647609 is displayed as 1.10000006e-032a64760a is displayed as 1.10000014e-032which is as expected.This has some serious effects on programs that rely on max_digits value being sufficient to reflect a one digit change. It will cause dificult to diagnose apparently random faults (only for about 1/3 of values) in Boost lexical_cast and Boost.serialisation and archive and Boost.Test, and many other user programs.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Operating System Language