English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2007-02-10 (14:55)
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.