Advertisement
rfmonk

decimal_precision.py

Jan 22nd, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.13 KB | None | 0 0
  1. import decimal
  2.  
  3. d = decimal.Decimal('0.123456')
  4. for i in range(4):
  5.     decimal.getcontext().prec = i
  6.     print i, ':', d, d * 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement