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: | Gerd Stolpmann <info@g...> |
| Subject: | Re: [Caml-list] Re: Reading 16 bit floats from stream? |
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 and make an int32 of them. Then simply call Int32.float_of_bits. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------