System.Numerics.Tests.logTest.LargeValueLogTests C# (CSharp) Méthode

LargeValueLogTests() private static méthode

Test Log Method on Very Large BigInteger more than (1 << Int.MaxValue) by base 2 Tested BigInteger are: pow(2, startShift + smallLoopShift * [1..smallLoopLimit] + Int32.MaxValue * [1..bigLoopLimit]) Note: ToString() can not operate such large values VerifyLogString() can not operate such large values, Math.Log() can not operate such large values
private static LargeValueLogTests ( int startShift, int bigShiftLoopLimit, int smallShift, int smallShiftLoopLimit = 1 ) : void
startShift int
bigShiftLoopLimit int
smallShift int
smallShiftLoopLimit int
Résultat void
        private static void LargeValueLogTests(int startShift, int bigShiftLoopLimit, int smallShift = 0, int smallShiftLoopLimit = 1)
        {
            BigInteger init = BigInteger.One << startShift;
            double logbase = 2D;

            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);
                    double expected =
                        (double)startShift +
                        smallShift * (double)(i + 1) +
                        (int.MaxValue / 2) * (double)(j + 1);
                    Assert.True(ApproxEqual(BigInteger.Log(temp, logbase), expected));
                }
                
            }
        }