From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 39244BC75 for ; Sun, 27 Feb 2005 01:20:58 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1R0KvKg023013 for ; Sun, 27 Feb 2005 01:20:58 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA02975 for ; Sun, 27 Feb 2005 01:20:57 +0100 (MET) Received: from swip.net (mailfe05.swip.net [212.247.154.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1R0KusB005879 for ; Sun, 27 Feb 2005 01:20:56 +0100 X-T2-Posting-ID: 2IIuXFmkcTpj3lKEFKW25A== Received: from [83.176.168.131] (HELO poincare) by mailfe05.swip.net (CommuniGate Pro SMTP 4.2.9) with ESMTP id 111729906; Sun, 27 Feb 2005 01:20:53 +0100 Received: from poincare ([127.0.0.1] helo=localhost ident=trch) by poincare with esmtp (Exim 3.36 #1 (Debian)) id 1D5C48-0002TW-00; Sun, 27 Feb 2005 01:13:44 +0100 Date: Sun, 27 Feb 2005 01:13:43 +0100 (CET) Message-Id: <20050227.011343.11780601.Christophe.Troestler@umh.ac.be> To: "O'Caml Mailing List" Cc: caml-bugs@pauillac.inria.fr Subject: [Bug] Different behavior bytecode/nativecode From: Christophe TROESTLER Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: investigation eavesdropping ANDVT LABLINK number key JSOFC3IP cryptographic Kh-11 Aldergrove wire transfer X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: GNU/Linux (http://www.linux.org/) X-Mailer-URL: http://www.mew.org/ X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Sun_Feb_27_01_13_43_2005_055)--" Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 42211269.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42211268.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bug:01 bytecode:01 nativecode:01 christophe:01 troestler:01 christophe:01 troestler:01 umh:01 bytecode:01 cheers:01 niter:01 byte:01 rec:01 byte:01 niter:01 X-Attachments: name="mandelbrot.ml" X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: ----Next_Part(Sun_Feb_27_01_13_43_2005_055)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, When I compile the attached program to bytecode, I get the output "0.000000 -1.000000 -> 1" (which is correct) but when I compile to native code the result is "0.000000 -1.000000 -> 0". The error stops when I substitute "invw" in "let cr = 300. *. invw -. 1.5" by its definition (i.e. if I write "let cr = 300. *. (2. /. float w) -. 1.5"). Curious to know what is the problem. Cheers, ChriS ----Next_Part(Sun_Feb_27_01_13_43_2005_055)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mandelbrot.ml" let niter = 50 let limit = 2. let limit2 = limit *. limit let add_bit0 cr ci byte = let rec loop i zr zi = if zr *. zr +. zi *. zi > limit2 then (byte lsl 1) lor 0x00 else if i > niter then (byte lsl 1) lor 0x01 else loop (i + 1) (zr *. zr -. zi *. zi +. cr) (2. *. zr *. zi +. ci) in loop 1 0. 0. let () = let w = 400 in let invw = 2. /. float w in let ci = -1. in let cr = 300. *. invw -. 1.5 in Printf.printf "%f %f -> %i\n" cr ci (add_bit0 cr ci 0); ----Next_Part(Sun_Feb_27_01_13_43_2005_055)----