From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 346E8BC57 for ; Wed, 1 Sep 2010 09:18:06 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0BAAibfUzRVdg2kGdsb2JhbACTP40ZCBUBAQEBCQkMBxEDH6MLiS6CFYZULohUAQEDBYU0BIQ4hVk X-IronPort-AV: E=Sophos;i="4.56,303,1280700000"; d="scan'208";a="58158018" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 01 Sep 2010 09:18:05 +0200 Received: by qwg5 with SMTP id 5so233214qwg.27 for ; Wed, 01 Sep 2010 00:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=lx6d3t+bVVoVWNQcZgiqWCJm1GCu91Y/SQhsUkuJSL0=; b=eZ2csyg+XvlaZSpauWoWBW+UQbQQnSry7qoBFpfjTZ37s+SI6kHt5XHYLSBV6XzH94 POG0ZD+ub/U6aCIR6waL3N4n34HSjGJckLlYTb8HDiz1AZuafHFxSSQL/Bcm/+qMwMC5 7EjohSe6DsAO4RvOR+t2bC1wusVxtTwCc+U24= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=PdXnlDpJeCX6kk0nLshO1WViWYFmkEXsAqyhAed0SEM3yqAUPmiypCq6uv2/em/TpW 8Nan0wc4QlCrtDwQQH4Rs89XDgY3fKuJQr4OLwUksbwf0sKpQB+HNzekWDljUiuimWuN Nc6LkxVrJT4Ww6trTshk0tn9s16NxCPPYaTNA= MIME-Version: 1.0 Received: by 10.229.241.12 with SMTP id lc12mr5040896qcb.178.1283325485214; Wed, 01 Sep 2010 00:18:05 -0700 (PDT) Received: by 10.229.233.15 with HTTP; Wed, 1 Sep 2010 00:18:05 -0700 (PDT) In-Reply-To: <031b01cb4944$77110900$65331b00$@com> References: <20100823.140626.634675953541672216.Christophe.Troestler+ocaml@umons.ac.be> <031b01cb4944$77110900$65331b00$@com> Date: Wed, 1 Sep 2010 11:18:05 +0400 Message-ID: Subject: Re: [Caml-list] Re: Question about float refs. From: Dmitry Bely To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; cheers:01 printf:01 printf:01 1.0:98 wrote:01 heap:01 dmitry:01 dmitry:01 caml-list:01 minor:01 bely:01 bely:01 caml:02 black:96 float:03 On Tue, Aug 31, 2010 at 11:41 PM, Jon Harrop wrote: > You might prefer to multiply by 1.0 because adding 0.0 changes -0.0. > > Cheers, > Jon. > >> Some black magic is needed: >> >> let r = ref 0.0 in >> for i = 0 to 1000_000_000 do r := float i done; >> Printf.printf "%f\n" (!r +. 0.); >> Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words >> >> and the reference will be placed in a register (Caml heap will not be >> used inside the loop) Do you have any idea why the optimizer needs that? - Dmitry Bely