title: Python Floats to 32 bit limited number
body: <p>As seen on this webiste: <a href="https://www.h-schmidt.net/FloatConverter/IEEE754.html" rel="nofollow noreferrer">https://www.h-schmidt.net/FloatConverter/IEEE754.html</a></p>
  
  <p>I have looked through five or so posts on stack overflow but they are not quite what I am looking for. For example:</p>
  
  <pre><code>import struct
  
  getBin = lambda x: x &gt; 0 and str(bin(x))[2:] or "-" + str(bin(x))[3:]
  
  def floatToBinary64(value):
      val = struct.unpack('Q', struct.pack('d', value))[0]
      return getBin(val)
  
  def binaryToFloat(value):
      hx = hex(int(value, 2))   
      return struct.unpack("d", struct.pack("q", int(hx, 16)))[0]
  
  # floats are represented by IEEE 754 floating-point format which are 
  # 64 bits long (not 32 bits)
  
  # float to binary
  binstr = floatToBinary64(NUMBER)
  print('Binary equivalent of .1:')
  print(binstr + '\n')
  
  # binary to float
  fl = binaryToFloat(binstr)
  print('Decimal equivalent of ' + binstr)
  print(fl)
  </code></pre>
  
  <p>I realize that this is pretty close to what I'm looking for. If you put .1 into this code where number is, it lists it as .1 while on the website it gives me: 0.10000000149011612.</p>
  
  <p>If anyone can help that would be great!</p>