Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
When constructing an object of BigInteger using BigInteger(Single)/BigInteger(Double) using floating point numbers between (0,1), The documentation specifies (https://msdn.microsoft.com/en-us/library/dd268360%28v=vs.110%29.aspx) that the fractional part of the parameter has to get truncated. This doesn't appear to be the case in Xamarin Android and mono 3.3.0. This can be checked by reading the Sign and IsZero properties in the resulting BigInteger object.
To reproduce, run the following code snippet:
System.Single v1 = (System.Single)0.001;
System.Numerics.BigInteger v2 = new System.Numerics.BigInteger(v1);
Boolean z = v5.IsZero;
int sign = v5.Sign;
z = true
sign = 0
z = false
sign = 1
The code snippet above was ran using Xamarin Android and Windows Phone 8.1. The
same issue happens when running the code in .Net 4.5 and mono 3.3.0.
It should be noted that the Windows Phone 8.1 and .Net 4.5 output the expected result.
Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
Already fixed in Mono 4.0