Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created May 10, 2018 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/b6272482cf0e3c889c7dc9ca2bbae5d9 to your computer and use it in GitHub Desktop.
Save Fhernd/b6272482cf0e3c889c7dc9ca2bbae5d9 to your computer and use it in GitHub Desktop.
Cálculos precisos con decimales. OrtizOL.
from decimal import Decimal
numero_1 = 4.2
numero_2 = 2.1
print(numero_1 + numero_2)
print((numero_1 + numero_2) == 6.3)
numero_1 = Decimal('4.2')
numero_2 = Decimal('2.1')
print(numero_1 + numero_2)
print((numero_1 + numero_2) == Decimal('6.3'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment