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: Mattias_Engdegård <mattias@v...>
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml
>Just to be sure: Would the compiler be wrong to optimize
>
>   c * q > c * k
>
>to just
>
>       q > k

With IEEE floating-point it would be wrong for several reasons.

Example 1: q and k are finite but c*q and c*k both are infinite.
Example 2: q and k are small, so that c*q and c*k both are +-0
Example 3: c is NaN but q and k are not.

I'm sure there are other examples involving but not limited to partial or total
loss of precision, positive/negative zero, infinities and NaNs.