lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hello all,

I'm a newbie here so be gentle ...

I need to convert back and forth between a string of bytes (4 bytes, 32-bits), and IEEE-754 floating point.  Basically I need to read a byte stream from a network socket and convert those bytes to a number.

For example I need to convert:
x = string.char(0x42, 0x96, 0x00, 0x00)

y = 74.0

And vice versa. I understand the IEEE-754 standard and if pressed could probably muddle through writing something from scratch.  But as with any programmer, if someone's already done it or if it's already in the language somewhere, it would just be easier than reinventing the wheel.

Any ideas folks?


Attachment: smime.p7s
Description: S/MIME cryptographic signature