-
Notifications
You must be signed in to change notification settings - Fork 21
Description
-
It seems that
std::to_charsreturnserrc::value_too_largerather thanerrc::result_out_of_range. Is this simply a mistake or do you have a reason for usingerrc::result_out_of_rangeinstead? In the code I edited I usederrc::result_out_of_rangefor consistency. -
to_charswith only buffer & value, with the format param as well, and with the precision param as well, all should be separate overloads. The reason why the first and the second should be separate overloads is because the first one should behave differently from the second one withfmt == chars_format::general; it needs to select whatever representation that is shortest, which does not always need to be equal tochars_format::general's output. The reason why the second and the third should be separate overloads is because by the spec,precisionbeing negative should be treated as ifprecision == 6, because the spec ofstd::printfsays that negative precision is ignored, which means it should fall back to the default, which is 6. I guess this is quite stupid, but well, it seems that's how the spec is written anyway.
EDIT: Ah, forgot to mention. When fixed format is chosen for the shortest representation, the output of Dragonbox may not be the correctly rounded one, because there can be trailing zeros in the integer part. (See fmtlib/fmt#3649 for a related discussion in libfmt.)