Bug 20721 - A cast of double to int can possibly result in int.MinValue
Summary: A cast of double to int can possibly result in int.MinValue
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-06-19 13:21 UTC by John Miller [MSFT]
Modified: 2018-04-05 19:43 UTC (History)
5 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 John Miller [MSFT] 2014-06-19 13:21:12 UTC
## Overview: 

    Sometimes truncating a perfectly normal positive double value (for example 18.1000359277301) with (int) results in int.MinValue (-2147483648).

## Additional Information: 

    No test case available.
Comment 3 John Miller [MSFT] 2014-06-19 16:03:36 UTC
## Additional Note

    Only reports from Xamarin.Android. No reports of this happening on iOS or on Mono desktop.
Comment 4 Ludovic Henry 2018-02-28 21:33:51 UTC
If we still have a contact with the customer, we should ask him to enable/disable `float32` and check with that, and also to reproduce with latest version of XA. Otherwise we would need an app that repro it, even just binaries. Is that something you think could be done?
Comment 5 Jonathan Pryor 2018-03-02 19:45:36 UTC
> we should ask him to enable/disable `float32`

We'd need to know *how* to do that.

I *think* that could be done with:

> adb shell setprop debug.mono.runtime_args '"-O=float32"'
Comment 6 Ludovic Henry 2018-04-05 19:43:53 UTC
Please reopen if you can still reproduce. Thank you