示例#1
0
        public static void GetCachedPowerForDecimalExponent(int requested_exponent,
                                                            out DiyFp power,
                                                            out int found_exponent)
        {
            int         index        = (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
            CachedPower cached_power = kCachedPowers[index];

            power          = new DiyFp(cached_power.significand, cached_power.binary_exponent);
            found_exponent = cached_power.decimal_exponent;
        }
示例#2
0
        public static void GetCachedPowerForBinaryExponentRange(
            int min_exponent,
            int max_exponent,
            out DiyFp power,
            out int decimal_exponent)
        {
            int    kQ    = DiyFp.kSignificandSize;
            double k     = Math.Ceiling((min_exponent + kQ - 1) * kD_1_LOG2_10);
            int    foo   = kCachedPowersOffset;
            int    index = (foo + (int)(k) - 1) / kDecimalExponentDistance + 1;

            CachedPower cached_power = kCachedPowers[index];

            // (void)max_exponent;  // Mark variable as used.
            decimal_exponent = cached_power.decimal_exponent;
            power            = new DiyFp(cached_power.significand, cached_power.binary_exponent);
        }