Version française
Home     About     Download     Resources     Contact us    
Browse thread
Is it a bug or just ordinary floating point differences?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Another example (was: Re: [Caml-list] Is it a bug or just ordinary floating point differences?)

----------------------------------------------------------------------
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