From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 633C1BC75 for ; Sun, 27 Feb 2005 03:33:25 +0100 (CET) Received: from redirect4.airmail.net (redirect4.airmail.net [209.196.123.153]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1R2XNJ4016330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 27 Feb 2005 03:33:25 +0100 Received: from host-216-39-197-163.mylinuxisp.com ([216.39.197.163] helo=welgehausen.net) by redirect4.airmail.net with smtp (Exim 4.24) id 1D5EIT-000GHG-0d for caml-list@yquem.inria.fr; Sat, 26 Feb 2005 20:36:41 -0600 Date: Sat, 26 Feb 2005 20:32:55 -0600 From: Kurt Welgehausen To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] [Bug] Different behavior bytecode/nativecode Message-ID: <42213157.mail3Z71XGC6B@kwel.net> References: <20050227.011343.11780601.Christophe.Troestler@umh.ac.be> In-Reply-To: <20050227.011343.11780601.Christophe.Troestler@umh.ac.be> User-Agent: nail 10.4 1/19/03 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 42213173.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 bug:01 bytecode:01 nativecode:01 printf:01 printf:01 endline:01 endline:01 ocaml:01 ocaml:01 300.:98 1.5:98 kaw:98 kaw:98 int:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: 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