Beispiel #1
0
 // Converts a Decimal to a float. Since a float has fewer significant
 // digits than a Decimal, this operation may produce round-off errors.
 //
 public static float ToSingle(Decimal d)
 {
     return(DecCalc.VarR4FromDec(ref d));
 }
Beispiel #2
0
 // Subtracts two Decimal values.
 //
 public static Decimal Subtract(Decimal d1, Decimal d2)
 {
     DecCalc.VarDecSub(ref d1, ref d2);
     return(d1);
 }
Beispiel #3
0
 // Converts a Decimal to a double. Since a double has fewer significant
 // digits than a Decimal, this operation may produce round-off errors.
 //
 public static double ToDouble(Decimal d)
 {
     return(DecCalc.VarR8FromDec(ref d));
 }
Beispiel #4
0
 // Rounds a Decimal to an integer value. The Decimal argument is rounded
 // towards negative infinity.
 //
 public static Decimal Floor(Decimal d)
 {
     DecCalc.VarDecInt(ref d);
     return(d);
 }
Beispiel #5
0
 public static Decimal Remainder(Decimal d1, Decimal d2)
 {
     return(DecCalc.VarDecMod(ref d1, ref d2));
 }
Beispiel #6
0
 public Decimal(double value)
 {
     DecCalc.VarDecFromR8(value, out AsMutable(ref this));
 }
Beispiel #7
0
 // Multiplies two Decimal values.
 //
 public static Decimal Multiply(Decimal d1, Decimal d2)
 {
     DecCalc.VarDecMul(ref d1, ref d2);
     return(d1);
 }
Beispiel #8
0
 public int CompareTo(Decimal value)
 {
     return(DecCalc.VarDecCmp(ref this, ref value));
 }
Beispiel #9
0
 // Divides two Decimal values.
 //
 public static Decimal Divide(Decimal d1, Decimal d2)
 {
     DecCalc.VarDecDiv(ref d1, ref d2);
     return(d1);
 }
Beispiel #10
0
 // Adds two Decimal values.
 //
 public static Decimal Add(Decimal d1, Decimal d2)
 {
     DecCalc.VarDecAdd(ref d1, ref d2);
     return(d1);
 }
Beispiel #11
0
 // Compares two Decimal values, returning an integer that indicates their
 // relationship.
 //
 public static int Compare(Decimal d1, Decimal d2)
 {
     return(DecCalc.VarDecCmp(ref d1, ref d2));
 }
Beispiel #12
0
 // Constructs a Decimal from a double value.
 //
 public Decimal(double value)
 {
     DecCalc.VarDecFromR8(value, out this);
 }
Beispiel #13
0
 // Constructs a Decimal from a float value.
 //
 public Decimal(float value)
 {
     DecCalc.VarDecFromR4(value, out this);
 }
Beispiel #14
0
 public static bool operator >=(Decimal d1, Decimal d2)
 {
     return(DecCalc.VarDecCmp(ref d1, ref d2) >= 0);
 }
Beispiel #15
0
 // Truncates a Decimal to an integer value. The Decimal argument is rounded
 // towards zero to the nearest integer value, corresponding to removing all
 // digits after the decimal point.
 //
 public static Decimal Truncate(Decimal d)
 {
     DecCalc.VarDecFix(ref d);
     return(d);
 }
Beispiel #16
0
 public bool Equals(Decimal value)
 {
     return(DecCalc.VarDecCmp(ref this, ref value) == 0);
 }
Beispiel #17
0
 public Decimal(float value)
 {
     DecCalc.VarDecFromR4(value, out AsMutable(ref this));
 }
Beispiel #18
0
 // Compares two Decimal values for equality. Returns true if the two
 // Decimal values are equal, or false if they are not equal.
 //
 public static bool Equals(Decimal d1, Decimal d2)
 {
     return(DecCalc.VarDecCmp(ref d1, ref d2) == 0);
 }
Beispiel #19
0
 public static long ToOACurrency(decimal value)
 {
     return(DecCalc.VarCyFromDec(ref AsMutable(ref value)));
 }
Beispiel #20
0
 internal static uint DecDivMod1E9(ref decimal value)
 {
     return(DecCalc.DecDivMod1E9(ref AsMutable(ref value)));
 }