Conversion to float array
Matej Košík
kosik at fiit.stuba.sk
Sun Jan 1 21:40:16 UTC 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Cowdery, Bob [UK] wrote:
> I am reading a sequence of bytes from a pipe. The data is actually 32
> bit float values. Is there an easy and efficient way to convert the byte
> array to a float array. Just doing asFloatArray not surprisingly gives
> me an array with each byte converted to a float and what I want is each
> 4 bytes converted to a float.
>
> Any help appreciated.
>
> Thanks
> Bob
Hi Bob,
If I had the testing file you have, I would try to do this:
Float fromIEEE32Bit: (Integer
byte1: stream next
byte2: stream next
byte3: stream next
byte4: stream next)
I assume that `stream next' gives me a single byte. But this need not be
the case. But you can try it.
Regards
- --
Matej Kosik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDuExAj6wbCo2ZNGIRAoLXAKDZ9pdfrHUCI8vFrZXnTrch9ZMNjwCfQaB6
u2+bDqZXz5FEKgeD4UxNnwA=
=XgNw
-----END PGP SIGNATURE-----
More information about the Squeak-dev
mailing list
|