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: Robert Roessler <roessler@r...>
Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml
Brian Hurt wrote:
> On Fri, 9 Feb 2007, Andrej Bauer wrote:
> 
>> 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
> 
> Round off error.  You can't represent numbers like 7/10 or 13/10 in 
> binary precisely in a finite number of digits, any more than you can 
> represent the numbers 1/3 or 4/7 precisely in base-10 in a finite number 
> of digits. This is a fundamental problem with floating point numbers, 
> and shows up in every language that has them.  But this means reordering 
> the calculations will result in slightly different answers.

I had assumed this was the point he was making...

Robert Roessler
roessler@rftp.com
http://www.rftp.com