Skip to content

Instantly share code, notes, and snippets.

@l337quez
Last active October 8, 2019 14:54
Show Gist options
  • Save l337quez/5739f80135c1f862a53cfcd7b84d7361 to your computer and use it in GitHub Desktop.
Save l337quez/5739f80135c1f862a53cfcd7b84d7361 to your computer and use it in GitHub Desktop.
Comparar numeros float en python
from decimal import Decimal
a = Decimal(219.92)
b = Decimal(219.52)
#con esto le decimos a la libreria que tome en cuenta estos decimales en la comparacion 0.001
if a.compare(Decimal(0.001)) >= b:
print ("YES")
else:
print ("NO")
print(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment