Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Floating point boxing again
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: malc <malc@p...>
Subject: [Caml-list] Floating point boxing again
let a n =
  let x = ref 1.0 in
  for i = 1 to n do
    x := !x +. 1.0;
  done;
  !x

let b n =
  let x = ref 1.0 in
  for i = 1 to n do
    x := !x +. 1.0;
  done;
  !x +. 0.0

The code produced for a and b respectively differ greatly, even the inner 
loops. Can someone from Caml team clarify the issue?

P.S. Native code obviously.

-- 
mailto:malc@pulsesoft.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners