How does Double.toString() work if a fraction number cannot be precisely represented in binary?
问题 I am unable to understand how Double.toString() works in Java/JVM. My understanding is that in general fraction numbers cannot be represented precisely in floating point types such as Double and Float. For example, the binary representation of 206.64 would be 206.6399999999999863575794734060764312744140625. Then how come (206.64).toString() returns "206.64" instead of "206.6399999999999863575794734060764312744140625"? Test code in Kotlin. @Test fun testBigDecimalToString() { val value = 206