Posted to tcl by kbk at Sun Feb 27 22:49:14 GMT 2011view raw

  1. # Input data, as reported by Thomas
  2. set data [binary format cccc 0x66 0x40 0x7d 0xe9]
  3. # Get two little-endian shorts from the data
  4. binary scan $data susu w0 w1
  5. # Put them back in the opposite sequence, and rescan them as a float
  6. binary scan [binary format ss $w1 $w0] r floatval
  7. # Report on the result
  8. puts $floatval