I'm decoding a binary data file and one thing I'm having
trouble with is a 24 bit/3 byte floating point number.

I've put the whole file into a array split every byte.

I've been trying pack/unpack but just can't seem to get
it to work. And maybe pack/unpack is not the right
way to go ?

Here's what the 3 bytes look like

Each numbers 3 bytes/24 bits, where the
least sig. byte is first, and then most sig. byte last,
at least the nibble order is ok :).
                                          
  |7             0|  |15            8|  |23           16|
  |_______|_______|  |_______|_______|  |_______|_______|
  |M|M|M|M|M|M|M|M|  |E|E|M|M|M|M|M|M|  |S|E|E|E|E|E|E|E|
  Least Sig. Byte                       Most Sig. Byte
 
  Sign      1 bit
  Exp       9 bits
  Mantissa 14 bits

  00 60 c0  =  -3.5
  00 00 40  =   2.0
  00 40 40  =   3.0
  00 60 40  =   3.5

TIA 

-pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to