&gt; printing the number might just cut off the digits at some point.<p>I&#x27;m not sure, but I <i>think</i> it&#x27;s not really about cutting off the digits (although that&#x27;s the effect it has). At least with python, I think what happens is:<p>* repr gives you the decimal number with the exact value of the floating-point number, i.e. 0.30000000000000004<p>* print gives you the least-precise decimal number whose closest floating-point representation is equal to the floating-point number<p>That is, there are (infinitely) many decimal numbers such that the closest floating-point representation has the value 0.30000000000000004. One of these decimal numbers is 0.3, and of all such decimal numbers, this has the fewest digits. So that&#x27;s the one that gets printed.