title: Float to IEEE-754 in split to two 16 bit words
body: <p>I need to end up with two words (each word is 16 bit) of the IEEE-754 representation of a Python float. 
  These words need to be passed to a function as ints.</p>
  
  <p>When I do what Im using now I sometimes get too big ints.</p>
  
  <p><code>OverflowError: Python int too large to convert to C long</code></p>
  
  <p>This is the code im using now:</p>
  
  <pre><code>def floatToWords(self, value):
          s = struct.pack('f', value).encode('hex')
          word1 = int(s, 16)
          word2 = int(s[2:4], 16)
          return word1, word2
  
  words = self.floatToWords(concentration)
  modbus.write_input_register(self.modbusAddress['concentration'],   words[0])
  modbus.write_input_register(self.modbusAddress['concentration']+1, words[1])
  </code></pre>
  
  <p>Am I converting it correctly?</p>
  
  <p>PS: Python 2.6</p>