From: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>
To: "O'Caml Mailing List" <caml-list@inria.fr>
Cc: caml-bugs@pauillac.inria.fr
Subject: [Bug] Different behavior bytecode/nativecode
Date: Sun, 27 Feb 2005 01:13:43 +0100 (CET) [thread overview]
Message-ID: <20050227.011343.11780601.Christophe.Troestler@umh.ac.be> (raw)
[-- Attachment #1: Type: Text/Plain, Size: 400 bytes --]
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
[-- Attachment #2: mandelbrot.ml --]
[-- Type: Text/Plain, Size: 484 bytes --]
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 reply other threads:[~2005-02-27 0:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-27 0:13 Christophe TROESTLER [this message]
2005-02-27 2:32 ` [Caml-list] " Kurt Welgehausen
2005-02-27 4:44 ` Jon Harrop
2005-02-27 10:13 ` Christophe TROESTLER
2005-02-27 11:10 ` Jon Harrop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050227.011343.11780601.Christophe.Troestler@umh.ac.be \
--to=christophe.troestler@umh.ac.be \
--cc=caml-bugs@pauillac.inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox