qberik

Untitled

Oct 31st, 2022 (edited)
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. from decimal import Decimal
  2.  
  3. def format(n):
  4. p = 0
  5. while n <= -1 or n >= 1:
  6. n /= Decimal(10.0)
  7. p += 1
  8. return "{:.30f}E{:+5d}".format(n, p)
  9.  
  10. a = Decimal('123123123.123123123E99999')
  11.  
  12. print( format( a ) )
  13.  
Advertisement
Add Comment
Please, Sign In to add comment