An archived instance of discourse for discussion in undergraduate Real and Numerical Analysis.

Generating a number from a 64 bit string


Suppose the sign, mantissa, and exponent of a 64 bit number are given by:
What is the decimal representation of the number?


I believe the answer is 1.806957261e-278.

I followed the notebook on Floating Point numbers and made a function in Python to read over the string of bits as text and compute what the 64 bit number would equate to.

import numpy as np

def BitStringToFloat(bitString):
    dd = np.zeros(52, dtype=int)
    for bits in range(1,53):
        if bitString[bits]=="1":
    ee = np.zeros(11, dtype=int)
    for bits in range(1,11):
    s= 1 if (bitString[0]=="1") else 0
    bins = [2**(-n) for n in range(1,53)]
    c =,bins)
    bins2 = [2**(n) for n in range(11)]
    e = int(,bins2)-1023)
    number_from_bin = (-1)**s * c * 2**e
    return (s,c,e)

Since your sign bit is 0 shouldn't your answer be positive? You have $$(-1)^1$$ instead of $$(-1)^0$$ with how your code is written or you could have just left it as $$s*c*2^e$$ instead of $$(-1)^s$$


My bad, that typo should be fixed now.