Last active
October 8, 2019 14:54
-
-
Save l337quez/5739f80135c1f862a53cfcd7b84d7361 to your computer and use it in GitHub Desktop.
Comparar numeros float en python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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