mono/mono — pull request #930 by theraot (2014-03-04 22:25:29+00:00)
Title: New cast to double and float for BigInteger

Replaced the old convertion code with a direct cast to double and an indirect to float passing through double, also extended the tests for the cast. The new code will only read the most significant words of the BigInteger and therfore avoiding iterating over the whole value allowing for execution in near constant time [some cases take a short path].

Also added some new helper methods:
- PopulationCount(ulong): returns the number of bits sets to 1 (new overload).
- LeadingZeroCount(uint) & LeadingZeroCount(ulong): returns the number of bits set to 0 at the beginning.
- BuildDouble: creates a new double by sign, mantissa and exponent.