Bug 13927 - Wrong result of double cast conversion
Summary: Wrong result of double cast conversion
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Duncan Mak
Depends on:
Reported: 2013-08-12 13:10 UTC by Marek Safar
Modified: 2013-08-21 15:40 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marek Safar 2013-08-12 13:10:11 UTC
using System;

class X
    public static void Main()
        double d = double.NaN;
        int i = (int)(uint)d;
        Console.WriteLine (i);

Mono on x86: -2147483648
.NET: 0
Comment 1 Zoltan Varga 2013-08-12 14:43:45 UTC
No idea why .net returns 0, (int)d is 0x80000000, so (uint)d should be the same.
Comment 2 Marek Safar 2013-08-13 15:56:51 UTC
No idea either but that break the compatibility.
Comment 3 Zoltan Varga 2013-08-16 13:49:24 UTC
Fixed in master cad5315ebf99f3ff2a36516f3a87df74691b126d.
Comment 4 Miguel de Icaza [MSFT] 2013-08-19 09:05:54 UTC
PJ, Duncan,

If we continue to use branched versions of Mono, we need to get this on the various places.
Comment 5 PJ 2013-08-21 12:17:57 UTC
cad5315ebf99f3ff2a36516f3a87df74691b126d is not in the current 3.2.2 release that was blessed on the 15th (before the fix). It's only in master right now.

We'll want it to be cherry-picked to mono-3-2 for the next 3.2.x release. 

If it needs to make it out in 3.2.2 let's make that decision ASAP, right now it's not making it.