Hello, what about converting each byte (represented by an int) to an int32, and then converting those using shifts and logical ors : "in" being our in_channel: let b0 = Int32.of_int (input_byte in) let b1 = Int32.of_int (input_byte in) let b2 = Int32.of_int (input_byte in) let b3 = Int32.of_int (input_byte in) let res = Int32.logor (Int32.logor (Int32.shift_left b0 24) (Int32.shift_left b1 16)) (Int32.logor (Int32.shift_left b2 8) (Int32.shift_left b3 0)). Hope this helps, Matthieu ----- Message d'origine ---- De : Maurizio Colucci Cc : caml-list Envoyé le : Lundi, 16 Octobre 2006, 19h06mn 46s Objet : Re: [Caml-list] Re: Reading 16 bit floats from stream? On 10/16/06, Gerd Stolpmann wrote: Am Montag, den 16.10.2006, 18:03 +0200 schrieb Maurizio Colucci: > > > On 10/16/06, Maurizio Colucci 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 _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Demandez à ceux qui savent sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com