Get from google search: public double GetPrecision(string s) { NumberFormatInfo nfi = new NumberFormatInfo(); string[] splitNumber = s.Split('.'); if (splitNumber.Length > 1) { return 1 / Math.Pow(10, splitNumber[1].Length); } else { return 1; } } public int getscale(decimal dec) { uint[] bits = (uint[])(object)decimal.GetBits(dec); uint scale = (bits[3] >> 16) & 31; return (int)scale; } const int SIGN_MASK = ~Int32.MinValue; public static int GetDigits(Decimal value) { return (Decimal.GetBits(value)[3] & SIGN_MASK) >> 16; }
No comments:
Post a Comment