[Mono-dev] JIT floating point behaviour change between 2.4.2 and 2.6
Rodrigo Kumpera
kumpera at gmail.com
Tue Jan 12 10:48:16 EST 2010
I'm guessing that those changes are al on 32bits x86, right?
Those are caused by some fixes in float <> double precision conversions.
Those fixes
are not yet present on amd64 so if you guys want to support it over unity it
might be a good
idea to help us do so. ;)
Revisions with those changes are:
127557
127558
127559
127560
127585
On Tue, Jan 12, 2010 at 1:27 PM, Lucas Meijer <lucas at lucasmeijer.com> wrote:
> Hi,
>
> In our process to upgrade to mono 2.6, we've hit a snag where floating
> point behaviour of the JIT is slightly differently. This program prints
> "PASS" on mono2.6, and "FAIL" on mono2.4, on both osx, and win32.
>
> using System;
>
> public class Test
> {
> static private float x;
> static private float y;
>
> private static void Main()
> {
> //input
> float a = DecodeSingle(0x3070787f);
> float b = DecodeSingle(0x48a296ba);
> float c = DecodeSingle(0x3ddc0d93);
>
> x = DecodeSingle(0xbfc2f2e5);
> y = DecodeSingle(0xbd35e18b);
>
> // test
> float abc = (a * b * c);
>
> float s = ((a * b * c) / sqrMagnitude);
> //same calculation,just using a temporary variable, which seems to matter
> float t = ((abc) / sqrMagnitude);
>
> Console.WriteLine("Test: {0}", ((s == t) ? "PASSED" :
> "FAILED"));
> }
>
> static private float sqrMagnitude
> {
> get { return ((x * x) + (y * y)); }
> }
>
> private static float DecodeSingle(uint value)
> {
> return
> BitConverter.ToSingle(BitConverter.GetBytes(value), 0);
> }
> }
>
> The good news is that mono2.6 behaviour looks correct, and Mono2.4
> behaviour wrong. I would really like to find out which svn revision has
> caused this change. We like the new behaviour, but want to temporarily
> get the old behaviour back, so we can succesfully run all our
> integrationtests, and feel confident that the mono upgrade didn't break
> anything. Because of the floating point difference, it's causing a lot
> of games in our regression suite to play back completely differently,
> which makes it hard to see if something else changed as well, or if the
> different playback is purely due to the floating point differences.
>
> I hope one of the JIT guys has a rough guess where this change might
> have been introduced, if not I'll start a the big boring svn based
> binary search.
>
> Thanks in advance,
>
> Lucas
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100112/a53cfb58/attachment.html
More information about the Mono-devel-list
mailing list