You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
import decimal
|
|
with decimal.localcontext() as context:
|
|
context.prec = 2
|
|
print('Local precision:', context.prec)
|
|
print('22/7 =', (decimal.Decimal('22') / 7))
|
|
|
|
print()
|
|
print('Default precision:', decimal.getcontext().prec)
|
|
print('22 /7 =', (decimal.Decimal('22') / 7)) |