/// <summary> /// Checks the sign of the AseDecimal value. /// </summary> /// <param name="value">The AseDecimal structure whose design is being checked.</param> /// <returns>Returns an integer 0 for null, 1 for positive, and -1 for a negative values respectively.</returns> public static int Sign(AseDecimal value) { return(value.IsNull ? 0 : value.IsNegative ? -1 : 1); }
public static bool TryParse(string s, out AseDecimal result) { try { result = Parse(s); return(true); } catch { result = Zero; return(false); } }
public static AseDecimal Round(AseDecimal n, int outputScale) { if (outputScale < 0) { throw new AseException("Invalid value.", 30037); } //handles cases where the number is 0 < x < 1 if (n < PositiveOne && n > NegativeOne) { outputScale -= 1; } return(new AseDecimal(n.Backing.Round(n.Precision - n.Scale + outputScale))); }
/// <summary> /// Initializes a new instance of the AseDecimal structure. /// </summary> /// <param name="aseDecimal">An AseDecimal structure to initialize the value of the new AseDecimal.</param> public AseDecimal(AseDecimal aseDecimal) : this(new BigDecimal(new BigInteger(aseDecimal.Backing.Mantissa.ToByteArray()), aseDecimal.Backing.Exponent)) { }
public static AseDecimal Floor(AseDecimal n) { return(new AseDecimal(n.Backing.Floor())); }
/// <summary> /// Compares the value of this AseDecimal with the AseDecimal value. /// </summary> public int CompareTo(AseDecimal value) { return(Backing.CompareTo(value.Backing)); }