Example #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 });
            }
        }
Example #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);
        }