On 12/05/2023 10:59, Peter Dimov wrote:
The work-in-progress documentation is here: https://develop.charconv.cpp.al/
Hex format will be of the form +1.0e2p+5. The integer part will always be 0 or 1. The exponent will be with a p instead of an e like in base 10 formats. This is some strange definition of "hex" with which I was previously unfamiliar.
It also contradicts itself, by saying "a p instead of an e" while the example contains both. (And isn't a very good example, lacking actual hex digits.) I've now found the reference to it -- https://en.cppreference.com/w/cpp/utility/to_chars says that "hex" uses as-if printf %a, and https://en.cppreference.com/w/cpp/io/c/fprintf says printf %a appears *somewhat* like the above (but I still think there is an error in the above). I also still think that whoever came up with that specification needs a whap upside the head, but then I've never encountered a reason to print a floating-point value in hex, so I assume there's some justification for it.