3 ms·
> it seems like it should be pretty fast (relative to system calls) to convert binary to decimal because 10 has a factor of 2 I don’t see how this would matter
by saagarjha 6y ago
> it seems like it should be pretty fast (relative to system calls) to convert binary to decimal because 10 has a factor of 2
I don’t see how this would matter?
- thethirdone 6y agoAny binary float is exactly representable in a decimal float with enough digits. This is not true in the other direction. for example 1/5th or 0.2 is 0.001100110011... in binary. So a simple solution for binary to decimal is to express it as a larger decimal float than you intend to show and then crop off digits if it doesn't fit in your destination format.