[Mono-bugs] [Bug 467201] New: float64 to float32 to float64 conversion bug

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 18 11:43:34 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=467201


           Summary: float64 to float32 to float64 conversion bug
    Classification: Mono
           Product: Mono: Runtime
           Version: unspecified
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: kornelpal at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


using System;
using System.Runtime.CompilerServices;

class Testing
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    static double GetValue()
    {
        return 0.19975845134874831D;
    }

    public static void Main()
    {
        double d = (float)GetValue();

    Console.Write("0x");
    foreach (byte b in BitConverter.GetBytes(d))
        Console.Write (b.ToString("x2"));
    Console.WriteLine();
        Console.WriteLine(d.ToString("R"));
    }
}

Results on MS.NET:
0x00000060af91c93f
0.19975845515727997

Results on Mono:
0xd23cd257af91c93f
0.19975845134874831

Also see http://lists.ximian.com/pipermail/mono-list/2009-January/041075.html

It contains the original code that should be fixed as well.

I belive that the bug is exposed by my compacted test case and makes the
problem easier to analize but please ensure that the original code in the
message works as well.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list