From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA16637; Tue, 3 Jun 2003 13:55:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA16650 for ; Tue, 3 Jun 2003 13:55:13 +0200 (MET DST) Received: from mail0.epfl.ch (mail0.epfl.ch [128.178.50.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id h53BtCT14825 for ; Tue, 3 Jun 2003 13:55:12 +0200 (MET DST) Received: (qmail 14765 invoked from network); 3 Jun 2003 11:55:12 -0000 Received: from lamppc32.epfl.ch (HELO epfl.ch) (128.178.154.41) by mail0.epfl.ch with SMTP; 3 Jun 2003 11:55:12 -0000 Message-ID: <3EDC8CA0.9090209@epfl.ch> Date: Tue, 03 Jun 2003 13:55:12 +0200 From: Sebastien Briais User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en, fr-fr MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] float numbers problem (CVS version of ocamlopt) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; ocamlopt:01 bug:01 3.06:01 toto:01 bash-:01 2.05:01 ocamlc:01 compiler:01 ocaml:01 bytecode:01 behaviour:01 float:02 compile:02 native:02 sebastien:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, when doing a little program in ocaml that uses float numbers, I found something that sounds like a bug in the native compiler. I have a PC (Pentium IV) with a RedHat 8.0 and the CVS version of ocaml : 3.06+34 I reduce the bug to the following file: -- start of file toto.ml let square x = x *. x let _ = let x = 1.84066666666666823 in let x0 = 1.16666666666666674 in let dx = 0.674000000000001487 in print_float (x -. x0); print_newline(); print_float (square (x -. x0)); print_newline(); print_float dx; print_newline(); print_float (square dx); print_newline(); -- end of file now, I compile this file with the bytecode compiler and then the native compiler (and execute the resulting file) bash-2.05b$ ocamlc -o toto toto.ml bash-2.05b$ ./toto 0.674000000000001487 0.454276000000002012 0.674000000000001487 0.454276000000002012 bash-2.05b$ ocamlopt -o toto.opt toto.ml bash-2.05b$ ./toto.opt 0.674000000000001487 nan. 0.674000000000001487 nan. The results obtained with the native code compiler are very strange, aren't they ? Does anyone else has this problem ? I have to say that I also tried with the official release 3.06 of ocaml and this worked perfectly. So, this strange behaviour has appeared after the latest official release of ocaml (3.06). (That's why I did not post to the bug tracker since it is not a bug of an official release) Regards Sébastien ------------------- 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