Exemplo n.º 1
0
        public static void GetCachedPowerForDecimalExponent(int requestedExponent, out DiyFp power, out int foundExponent)
        {
            var index       = (requestedExponent + KCachedPowersOffset) / KDecimalExponentDistance;
            var cachedPower = KCachedPowers[index];

            power         = new DiyFp(cachedPower.Significand, cachedPower.BinaryExponent);
            foundExponent = cachedPower.DecimalExponent;
        }
Exemplo n.º 2
0
        public static void GetCachedPowerForBinaryExponentRange(
            int minExponent,
            int maxExponent,
            out DiyFp power,
            out int decimalExponent)
        {
            var kQ    = DiyFp.KSignificandSize;
            var k     = Math.Ceiling((minExponent + kQ - 1) * KD1Log210);
            var foo   = KCachedPowersOffset;
            var index = (foo + (int)(k) - 1) / KDecimalExponentDistance + 1;

            var cachedPower = KCachedPowers[index];

            // (void)max_exponent;  // Mark variable as used.
            decimalExponent = cachedPower.DecimalExponent;
            power           = new DiyFp(cachedPower.Significand, cachedPower.BinaryExponent);
        }