Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Bug] Different behavior bytecode/nativecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Kurt Welgehausen <kwel@k...>
Subject: Re: [Caml-list] [Bug] Different behavior bytecode/nativecode
The problem is in the calculation of cr: it's not really 0.0
in the native code.  I can't tell you why.

let () =
  let w = 400 in
  let invw = 2. /. float w in
  let ci = -1. in
  let cr = 300. *. invw -. 1.5 in
  Printf.printf "%.19f %f -> %i\n" cr ci (add_bit0 cr ci 0);
  print_endline ("invw->"^(Int64.to_string (Int64.bits_of_float invw)));
  print_endline ("cr->"^(Int64.to_string (Int64.bits_of_float cr)));
  print_endline ("ci->"^(Int64.to_string (Int64.bits_of_float ci)))

**kaw<~/ocaml>$ ./mandelbrot
0.0000000000000000000 -1.000000 -> 1
invw->4572414629676717179
cr->0
ci->-4616189618054758400
**kaw<~/ocaml>$ ./mandelbrot.opt 
0.0000000000000000312 -1.000000 -> 0
invw->4572414629676717179
cr->4360047389248061440
ci->-4616189618054758400


Regards