Bug 28572 - Incorrect/Inconsistent System.Numerics.Complex.Divide(Complex dividend, Complex divisor) result
Summary: Incorrect/Inconsistent System.Numerics.Complex.Divide(Complex dividend, Compl...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: General ()
Version: 3.10.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-03-31 00:51 UTC by nader
Modified: 2015-03-31 04:58 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description nader 2015-03-31 00:51:29 UTC
It appears that in Xamarin Android and mono 3.3.0 the System.Numerics.Complex.Divide(Complex dividend, Complex divisor) returns the wrong result when the dividend is 0 and the divisor is infinity. Mathematically, the result should be zero. In addition, the .Net implementation's result, matches the mathematical result.

This is similar to a bug I reported earlier (https://bugzilla.xamarin.com/show_bug.cgi?id=28562) and the fix for that issue might be related to the fix for this one.

To reproduce this issue, run the following code snippet
var n = new System.Numerics.Complex (0, 0);
var d = new System.Numerics.Complex (Double.NegativeInfinity, 0);
System.Numerics.Complex r = System.Numerics.Complex.Divide(n, d) ;

Expected result: r=(0,0)
Xamarin Android result: r=(NAN,NAN)

The code snippet above was ran using Xamarin Android 4.16, mono 3.3.0, Windows Phone 8.1, and .Net 4.5. 

Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
Comment 1 Marek Safar 2015-03-31 04:58:36 UTC
Already fixed in Mono 4.0