From my understanding, when assigning any double value to a variable, it will go through these steps :
- Convert to binary.
- Do some shifting in format of scientific notation.
- Convert to IEEE754.
Both step 1 and step 3 may introduce some inaccuracy. So the value stored in memory is already not accurate.
But surprisingly, if I don't do any calculation on this double and just print it out like: println(0.2d)
or even
println(1245.1325415d)
As long as the double is not too long, the result'd always be accurate.
Is there any tricks done when converting the IEEE754 format back to Base10 format?