3 ms·
> If you want round-trip conversion for all `double` numbers, i.e. from `double` to text and back I don't. Rather, I want round-trip conversion of all 15-digit
by kazinator 11y ago
> If you want round-trip conversion for all `double` numbers, i.e. from `double` to text and back
I don't. Rather, I want round-trip conversion of all 15-digit-precision decimal numbers to the machine and back. If the machine calculates some numbers which are different from some of these but alias to them textually, I don't care.
Someone else might want the decimal text representation to provide bit-exact storage semantics for arbitrary doubles.
For that reason it might be a better design choice to obtain the default printing precision from a special variable, which itself defaults to 15, rather than a hard-coded default.
- deleted 11y ago[deleted]
- mortehu 11y agoIf you want that, that comes at the cost of printing 0.99999999999999989 as "1".
- kazinator 11y agoWell, yes; 0.99999999999999989 isn't a 15 digit number, so it lies outside of the requirement.
- thedufer 11y agoThe downside to printing only 15 is that you then have numbers that print the same but compare as not equal.