caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kurt Welgehausen <kwel@kwel.net>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] [Bug] Different behavior bytecode/nativecode
Date: Sat, 26 Feb 2005 20:32:55 -0600	[thread overview]
Message-ID: <42213157.mail3Z71XGC6B@kwel.net> (raw)
In-Reply-To: <20050227.011343.11780601.Christophe.Troestler@umh.ac.be>

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


  reply	other threads:[~2005-02-27  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-27  0:13 Christophe TROESTLER
2005-02-27  2:32 ` Kurt Welgehausen [this message]
2005-02-27  4:44 ` [Caml-list] " 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=42213157.mail3Z71XGC6B@kwel.net \
    --to=kwel@kwel.net \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).