Browse thread
Reading 16 bit floats from stream?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Maurizio Colucci <maurizio.colucci@g...> |
| Subject: | Re: [Caml-list] Re: Reading 16 bit floats from stream? |
On 10/16/06, Gerd Stolpmann <info@gerd-stolpmann.de> wrote: > > Am Montag, den 16.10.2006, 18:03 +0200 schrieb Maurizio Colucci: > > > > > > On 10/16/06, Maurizio Colucci <maurizio.colucci@gmail.com> wrote: > > Hi, > > > > I need to read a sequence of single precision floats (16 bits) > > from a binary file. How can I do that? > > > > Sorry, I mean 32 bits. Single precision floats are 32 bits. > > Well, have heard of even 8 bit floats... > > 32 bit floats can be read. First read the 4 bytes I assume you mean four read_bytes calls... and make an int32 of > them. How do I create an int32 with four bytes? Then simply call Int32.float_of_bits. I get this last one, but I can't imagine the previous step. Thanks Maurizio