From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.5 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, HTML_MESSAGE,MISSING_HEADERS,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 87D64BC68 for ; Mon, 16 Oct 2006 19:06:51 +0200 (CEST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.230]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9GH6oD1004611 for ; Mon, 16 Oct 2006 19:06:51 +0200 Received: by wx-out-0506.google.com with SMTP id s6so1716634wxc for ; Mon, 16 Oct 2006 10:06:46 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:subject:cc:in-reply-to:mime-version:content-type:references; b=d2q5mN5wsQJdKw/NXS/n9360hyuCCTOMYD05WkUbxt27NsxYVHPWUy1hswrEEBd5J7qXSkja8okwt0SIUHlS+umSfl6ZhEeLtekymxTs6oudzxnHim/IreBIb+5GJ/ipG/bT3pjU9dKTOBJif8jCbMucMUDhMJb5J5q7c9jlWWA= Received: by 10.90.52.18 with SMTP id z18mr3794325agz; Mon, 16 Oct 2006 10:06:46 -0700 (PDT) Received: by 10.90.92.6 with HTTP; Mon, 16 Oct 2006 10:06:46 -0700 (PDT) Message-ID: Date: Mon, 16 Oct 2006 19:06:46 +0200 From: "Maurizio Colucci" Subject: Re: [Caml-list] Re: Reading 16 bit floats from stream? Cc: caml-list In-Reply-To: <1161016042.18038.2.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_40819_25956337.1161018406085" References: <1161016042.18038.2.camel@localhost.localdomain> X-j-chkmail-Score: MSGID : 4533BC2A.002 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 4533BC2A.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 binary:01 gerd:01 stolpmann:01 binary:01 W8:98 W8:98 wrote:01 wrote:01 caml-list:01 int:01 int:01 floats:02 floats:02 ------=_Part_40819_25956337.1161018406085 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_40819_25956337.1161018406085 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

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

------=_Part_40819_25956337.1161018406085--