programming-examples/python/Math/Round a specified decimal by setting precision.py

7 lines
191 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
import decimal
d = decimal.Decimal('00.26598')
print("Original Number : ",d)
for i in range(1, 5):
decimal.getcontext().prec = i
print("Precision-",i, ':', d * 1)