示例#1
0
        public static FastIntegerFixed[] DigitLengthBoundsFixed <THelper>(
            IRadixMathHelper <THelper> helper,
            FastIntegerFixed fei)
        {
            int radix = helper.GetRadix();
            FastIntegerFixed fastpath = FastPathDigitLength(fei, radix);

            if (fastpath != null)
            {
                return(new FastIntegerFixed[] { fastpath, fastpath });
            }
            if (radix == 10)
            {
                EInteger[] fi = DecimalDigitLengthBoundsAsEI(fei.ToEInteger());
                return(new FastIntegerFixed[] {
                    FastIntegerFixed.FromBig(fi[0]),
                    FastIntegerFixed.FromBig(fi[1]),
                });
            }
            else
            {
                FastInteger      fi  = helper.GetDigitLength(fei.ToEInteger());
                FastIntegerFixed fif = FastIntegerFixed.FromFastInteger(fi);
                return(new FastIntegerFixed[] { fif, fif });
            }
        }
示例#2
0
        public static FastIntegerFixed DigitLengthFixed <THelper>(
            IRadixMathHelper <THelper> helper,
            FastIntegerFixed fei)
        {
            FastIntegerFixed fastpath = FastPathDigitLength(fei, helper.GetRadix());

            if (fastpath != null)
            {
                return(fastpath);
            }
            FastInteger      fi  = helper.GetDigitLength(fei.ToEInteger());
            FastIntegerFixed fif = FastIntegerFixed.FromFastInteger(fi);

            return(fif);
        }
示例#3
0
        public static FastInteger[] DigitLengthBounds <THelper>(
            IRadixMathHelper <THelper> helper,
            EInteger ei)
        {
            int radix = helper.GetRadix();

            if (radix == 2)
            {
                FastInteger fi =
                    FastInteger.FromBig(ei.GetUnsignedBitLengthAsEInteger());
                return(new FastInteger[] { fi, fi });
            }
            else if (radix == 10)
            {
                return(DecimalDigitLengthBounds(ei));
            }
            else
            {
                FastInteger fi = helper.GetDigitLength(ei);
                return(new FastInteger[] { fi, fi });
            }
        }