From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: Another example (was: Re: [Caml-list] Is it a bug or just ordinary floating point differences?)
Date: Mon, 17 Nov 2008 12:23:31 +0000 [thread overview]
Message-ID: <20081117122331.GB21299@annexia.org> (raw)
In-Reply-To: <20081117102310.GA21299@annexia.org>
----------------------------------------------------------------------
open Printf ;;
printf "%d\n" (int_of_float (62.05 *. 60.)) ;;
let s = 62.05 *. 60. ;;
printf "%d\n" (int_of_float s) ;;
----------------------------------------------------------------------
Ordinary ocamlopt prints:
3723
3723
The cross-compiler prints:
3722
3723
The generated assembly is again identical apart from differences which
seem insignificant to me. Shown below is the diff between the
ocamlopt 3.10.2 for Windows downloaded from caml.inria.fr, and my own
cross-compiler (both running under Wine).
I'm thinking the difference must be somewhere in Wine itself or in the
way that the two compilers initialize the floating point environment,
such as using different rounding modes.
Does anyone have a true Windows version of 3.11.0 that they could
check out the test programs on?
Rich.
--- test_float2-win-3.10.2.s 2008-11-17 12:13:26.000000000 +0000
+++ test_float2-crosswin-3.11.0.s 2008-11-17 12:14:09.000000000 +0000
@@ -26,7 +26,7 @@
subl $8, %esp
L100:
movl $_camlTest_float2__2, %eax
- call _camlPrintf__printf_364
+ call _camlPrintf__printf_403
L101:
movl %eax, %ebx
fldl L102
@@ -58,7 +58,7 @@
fstpl (%eax)
movl %eax, _camlTest_float2
movl $_camlTest_float2__1, %eax
- call _camlPrintf__printf_364
+ call _camlPrintf__printf_403
L108:
movl %eax, %ebx
movl _camlTest_float2, %eax
@@ -88,6 +88,7 @@
L103: .double 62.05
.data
L102: .double 60.
+ .data
.text
.globl _camlTest_float2__code_end
_camlTest_float2__code_end:
--
Richard Jones
Red Hat
next prev parent reply other threads:[~2008-11-17 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 10:23 Is it a bug or just ordinary floating point differences? Richard Jones
2008-11-17 12:23 ` Richard Jones [this message]
2008-11-17 12:26 ` Another example (was: Re: [Caml-list] Is it a bug or just ordinary floating point differences?) Richard Jones
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=20081117122331.GB21299@annexia.org \
--to=rich@annexia.org \
--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