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=0.6 required=5.0 tests=NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 31CB2BC69 for ; Sat, 10 Feb 2007 15:36:43 +0100 (CET) Received: from server2.thinkcrime.de (server2.thinkcrime.de [213.133.110.149]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1AEagqK001542 for ; Sat, 10 Feb 2007 15:36:43 +0100 Received: from hod-sarge-2005-10.lan.m-e-leypold.de (dslb-088-074-033-177.pools.arcor-ip.net [88.74.33.177]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server2.thinkcrime.de (Postfix) with ESMTP id 263F3488032 for ; Sat, 10 Feb 2007 15:36:44 +0100 (CET) Received: by hod-sarge-2005-10.lan.m-e-leypold.de (Postfix, from userid 1003) id 12543376C1; Sat, 10 Feb 2007 15:41:55 +0100 (CET) To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml References: <45CAF3E2.7020807@univ-paris12.fr> <200702092353.09173.jon@ffconsultancy.com> <121wkybxh5.fsf@hod.lan.m-e-leypold.de> <200702100224.32450.jon@ffconsultancy.com> From: ls-ocaml-developer-2006@m-e-leypold.de Date: Sat, 10 Feb 2007 15:41:54 +0100 In-Reply-To: <200702100224.32450.jon@ffconsultancy.com> (Jon Harrop's message of "Sat, 10 Feb 2007 02:24:32 +0000") Message-ID: User-Agent: Some cool user agent (SCUG) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at concorde with ID 45CDD87A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 compiler:01 compiler:01 gcc:01 flags:01 bug:01 flags:01 markus:01 wrote:01 integer:01 caml-list:01 writes:01 expression:02 floats:02 specify:06 Jon Harrop writes: > On Saturday 10 February 2007 01:41, ls-ocaml-developer-2006@m-e-leypold.de > wrote: >> Sorry, I wanted to say "optimize (a * b) *c == a * (b * c) to true", >> i.e. 1. Would the compiler be wrong/incorrect in doing so? > > Yes. Just to be sure: Would the compiler be wrong to optimize c * q > c * k to just q > k (all floats). And why? If not, why, in the case above? I don't want letter and verse, but a general hand waving in the right direction would be nice, since I have the impression, that is exactly what Gcc 4.1. is currently doing (though for the integer case). > Provided you only specify -O* optimisation flags, I believe that reducing that > expression to "true" in the general case would be a compiler bug. If you > specify flags like -ffast-math then anything can happen, but it will happen > very quickly! ;-) :-) Regards -- Markus