Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiplication of matrix in C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ls-ocaml-developer-2006@m...
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml

Jon Harrop <jon@ffconsultancy.com> 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