-
-
Save yoursunny/c1e0aef17c74a23d23b85fca01a95f85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b = 0 | |
m_bits = 5 | |
m_max = (1<<m_bits) | |
for i in range(0,256): | |
e = i >> m_bits | |
m = i & ((1<<m_bits) - 1) | |
if e == 0: | |
x = (0 + m / m_max) * pow(2, 1 + b) | |
else: | |
x = (1 + m / m_max) * pow(2, e + b) | |
print ("%d (e=%d, m=%d) = %f" % (i, e, m, x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment