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-09 (21:55)
From: Andrej Bauer <Andrej.Bauer@f...>
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml
I hate to add to this long discussion, but since when is floating point 
multiplication associative?

# 1.3 *. (0.7 *. 2.1) = (1.3 *. 0.7) *. 2.1 ;;
- : bool = false

The suggestion that the results be tested for validity by checking the 
associative law of multipliciation won't worky very well, and neither 
will commutativity. In this case, instead of checking that A = B holds, 
it's better to output the difference between A and B (in case A and B 
are matrices, output the sup norm of the difference to keep it down to a 
single number).