Bug 46970 - Divide by zero bug, or possible (double) bug
Summary: Divide by zero bug, or possible (double) bug
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 4.6.0 (C8)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-11-15 03:06 UTC by civilwarrock
Modified: 2017-10-06 23:43 UTC (History)
3 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 civilwarrock 2016-11-15 03:06:04 UTC
If you run the following code on Windows i will be: -2147483648, and that is using .Net Framework 4.0
However if you run the following code on Mono using version 4.6.1 JIT, i will be: 2147483647.

int a = 0;
int b = 20;
int i = (int)(((double)System.Math.Abs(a - b) / (double)a) * 100);

I thought you guys would like to know this problem exists.
Comment 1 Ludovic Henry 2017-10-06 23:43:00 UTC
I cannot repro with Mono (2017-10/a3943e28cf8) on macOS and Mono on Ubuntu 16.04 64bits