Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2009 Doug Hellmann All rights reserved.
  5. #
  6. """
  7. """
  8. #end_pymotw_header
  9.  
  10. import decimal
  11. import fractions
  12.  
  13. for v in [ decimal.Decimal('0.1'),
  14. decimal.Decimal('0.5'),
  15. decimal.Decimal('1.5'),
  16. decimal.Decimal('2.0'),
  17. ]:
  18. print '%s = %s' % (v, fractions.Fraction.from_decimal(v))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement