0

I run the following code:

numero = 80.12
a = int(numero)
b = abs(numero) - abs(int(numero))
print(a,b)

And as a result I get...

80, 0.12000000000000455

I don't know what could be the problem of printing excess of decimal places.

1 Answers1

1

The full gory details can be found in this documentation. Floating point representations of decimal fractions are almost never precise.

Frank Yellin
  • 9,127
  • 1
  • 12
  • 22