3 ms·
I was wondering why he said that CSV was not capable of supporting full precision for doubles. Are you saying that the problem is not with CSV per se, but inst
by nkurz 12y ago
I was wondering why he said that CSV was not capable of supporting full precision for doubles. Are you saying that the problem is not with CSV per se, but instead the C libc printf function? I'd have thought that modern standard libraries would do this right with the usual decimal %f and a large enough precision: http://pubs.opengroup.org/onlinepubs/009695399/functions/printf.html http://pubs.opengroup.org/onlinepubs/009695399/functions/pri...
- stephencanon 12y agoThe trouble is that (a) the standard recommends but does not require that all binary-to-decimal and decimal-to-binary conversions be correctly rounded and (b) even if it did require correctly-rounded conversions, the precision needs to be absolutely enormous to guarantee that every double is exactly representable in the chosen format (which makes it wildly wasteful), otherwise you'd get different results depending on the rounding mode in effect at the time of conversion back to double.