According to this float converter(https://www.h-schmidt.net/FloatConverter/IEEE754.html), 0.1 is actually stored binary as 00111101110011001100110011001101.....(infinite). Its decimal representation then is something like 0.100000001490116119384765625. How Java,for example, when we store a float like 0.1 and we print it, is actually represented as "0.1" and not the real value stored like "0.100000001490116119384765625"?
Thanks
double, the result is 0.1000000000000000055511151231257827021181583404541015625. When printed with default formatting, this is shown as “0.1” because Java’s default formatting is to convert the actual number to the shortest decimal numeral such that converting the decimal numeral back todoubleyields thedoublevalue. This creates an illusion that thedoubleis .1, but, actually, .1 is just close to thedoublevalue. (Shortest by number of significant digits, not string length.)