3 ms·
Note that you can uniquely identify all floats by printing them with printf(“%1.8e”): https://randomascii.wordpress.com/2013/02/07/float-precision-revisited-ni
by nestorD 7y ago
Note that you can uniquely identify all floats by printing them with printf(“%1.8e”):
https://randomascii.wordpress.com/2013/02/07/float-precision-revisited-nine-digit-float-portability/ https://randomascii.wordpress.com/2013/02/07/float-precision...
- pascal_cuoq 7y agoAs the parent already said, the nice thing about hexadecimal floating-point is that the standard MANDATES that you get exactly the float/double you have uniquely described. The assertion “you can uniquely identify all floats by printing them with printf("%1.8e")” on the other hand relies on the compiler using round-to-nearest for conversions between binary and decimal, which the standard does not mandate and which, even when the compiler documents the choice, is sophisticated enough that the compiler/printf/strtod may get it wrong for difficult inputs: https://www.exploringbinary.com/tag/bug/ https://www.exploringbinary.com/tag/bug/