Read this question carefully because I am not asking how to get rid of trailing zeros, that’s easy.
What I am asking is why does 123d become “123.0”?
A IEEE 64-bit float can represent integers from 0 to 2^52 exactly, so this isn’t a loss in precision but a decision during the implementation of Double.toString().
My question is why did they make this decision as they did? Why did they not just print 123?
Among other things, it leads to clarity of representation – users are often confused when what seems to be an integer value suddenly has a long trail of digits after the decimal place after a simple arithmetic operation.