Rounding In Python
round(1.4 999 999 999 999 999) (without the spaces) gets rounded to 2 but round(1.4 99 999 999 999 999) (without the spaces) gets rounded to 1. I suppose this has to do with impre
Solution 1:
Because 1.4 999 999 999 999 999
when parsed is exactly 1.5, the difference between them is too small to represent at that magnitude.
But 1.4 99 999 999 999 999
is low enough to parse to "less than 1.5", actually 1.4999999999999988897769753748434595763683319091796875, which is clearly less than 1.5
Post a Comment for "Rounding In Python"