3 ms·
I do mention if you simply increase the length of the formatted string you can do round-trip. It should be noted however (as I do) that the decimal number is st
by mortoray 11y ago
I do mention if you simply increase the length of the formatted string you can do round-trip. It should be noted however (as I do) that the decimal number is still not equivalent to the actual floating point number, only that when converted back it is the same. This point could, in theory, be an issue if your serialized form crosses systems that use different floating point systems.
- panic 11y agoIt should be noted however (as I do) that the decimal number is still not equivalent to the actual floating point number, only that when converted back it is the same. Since 2 divides evenly into 10, every binary number has an exact decimal representation, and you can produce a decimal string which is equivalent to any floating point number. You may need quite a few digits, though.
- brucedawson 11y agoIf you are trying to get exact compatibility between systems with different floating-point systems then serializing to text is the least of your problems.