Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Created March 16, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbielawa/9591150 to your computer and use it in GitHub Desktop.
Save tbielawa/9591150 to your computer and use it in GitHub Desktop.
bitmath converts almost anything https://github.com/tbielawa/bitmath More information: https://blog.lnx.cx/?p=521
>>> from bitmath import *
>>> four_mibibits = Mib(4)
>>> four_mibibits.to_kB()
kB(524.288)
>>> ninty_nine_bits = Bit(99)
>>> a_small_exbibyte = ninty_nine_bits.to_EiB()
>>> print "This might as well be zero: %s" % a_small_exbibyte
This might as well be zero: 1.07336015076e-17EiB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment