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