3 ms·
I'm not sure, but generally speaking converting doubles to strings will fail to round trip at least the NaNs If round tripping is important, my recommendation
by ufo 7y ago
I'm not sure, but generally speaking converting doubles to strings will fail to round trip at least the NaNs
If round tripping is important, my recommendation would be to output something that directly corresponds to the binary representation of the float. For example, printf %a
- theoh 7y agoSee this article for an in-depth look at implementing these conversions: https://research.swtch.com/ftoa https://research.swtch.com/ftoa