System.Numerics.Tests.cast_fromTest.DoubleExplicitCastFromLargeBigIntegerTests C# (CSharp) Method

DoubleExplicitCastFromLargeBigIntegerTests() private static method

Test cast to Double on Very Large BigInteger more than (1 << Int.MaxValue) Tested BigInteger are: +/-pow(2, startShift + smallLoopShift * [1..smallLoopLimit] + Int32.MaxValue * [1..bigLoopLimit]) Expected double is positive and negative infinity Note: ToString() can not operate such large values
private static DoubleExplicitCastFromLargeBigIntegerTests ( int startShift, int bigShiftLoopLimit, int smallShift, int smallShiftLoopLimit = 1 ) : void
startShift int
bigShiftLoopLimit int
smallShift int
smallShiftLoopLimit int
return void
        private static void DoubleExplicitCastFromLargeBigIntegerTests(int startShift, int bigShiftLoopLimit, int smallShift = 0, int smallShiftLoopLimit = 1)
        {
            BigInteger init = BigInteger.One << startShift;

            for (int i = 0; i < smallShiftLoopLimit; i++)
            {
                BigInteger temp = init << ((i + 1) * smallShift);

                for (int j = 0; j < bigShiftLoopLimit; j++)
                {
                    temp = temp << (int.MaxValue / 2);
                    VerifyDoubleExplicitCastFromBigInteger(Double.PositiveInfinity, temp);
                    VerifyDoubleExplicitCastFromBigInteger(Double.NegativeInfinity, -temp);
                }

            }
        }