Beispiel #1
0
 public static Decimal64 FromFixedPoint(long mantissa, int numberOfDigits)
 {
     // TODO: More optimizations
     return(new Decimal64(
                0 == (mantissa & (-1L << 53))
                         ? DotNetImpl.FromFixedPointLimitedU64((UInt64)mantissa, numberOfDigits)
                         : NativeImpl.fromFixedPoint64(mantissa, numberOfDigits)));
 }
Beispiel #2
0
 /// <summary>
 /// Returns canonical representation of Decimal.
 /// We consider that all binary representations of one arithmetic value have the same canonical binary representation.
 /// Canonical representation of zeros = <see cref="Zero"/>>
 /// Canonical representation of NaNs = <see cref="NaN"/>
 /// Canonical representation of PositiveInfinities = <see cref="PositiveInfinity"/>
 /// Canonical representation of NegativeInfinities = <see cref="NegativeInfinity"/>
 /// </summary>
 /// <returns>Canonical representation of decimal argument.</returns>
 public Decimal64 Canonize()
 {
     if (IsNaN())
     {
         return(NaN);
     }
     if (IsInfinity())
     {
         if (IsPositiveInfinity())
         {
             return(PositiveInfinity);
         }
         else
         {
             return(NegativeInfinity);
         }
     }
     return(new Decimal64(DotNetImpl.Canonize(this.Bits)));
 }
Beispiel #3
0
 public Decimal64 Abs()
 {
     return(new Decimal64(DotNetImpl.Abs(Bits)));
 }
Beispiel #4
0
 public Boolean IsFinite()
 {
     return(DotNetImpl.IsFinite(Bits));
 }
Beispiel #5
0
 public Decimal64 Negate()
 {
     return(new Decimal64(DotNetImpl.Negate(Bits)));
 }
Beispiel #6
0
 public static Decimal64 operator -(Decimal64 value)
 {
     return(new Decimal64(DotNetImpl.Negate(value.Bits)));
 }
Beispiel #7
0
 public Boolean IsNonNegative()
 {
     return(DotNetImpl.IsNonNegative(Bits));
 }
Beispiel #8
0
 public override String ToString()
 {
     return(DotNetImpl.ToString(Bits));
     //return ((Double)this).ToString(CultureInfo.InvariantCulture);
 }
Beispiel #9
0
 public static Decimal64 FromDecimalDouble(Double value)
 {
     return(new Decimal64(DotNetImpl.FromDecimalFloat64(value)));
 }
Beispiel #10
0
 public Boolean IsPositive()
 {
     return(DotNetImpl.IsPositive(Bits));
 }
Beispiel #11
0
 public Boolean IsSigned()
 {
     return(DotNetImpl.SignBit(Bits));
 }
Beispiel #12
0
 public static Decimal64 FromFixedPoint(uint mantissa, int numberOfDigits)
 {
     return(new Decimal64(DotNetImpl.FromFixedPoint32(mantissa, numberOfDigits)));
 }
Beispiel #13
0
 public Boolean IsNegativeInfinity()
 {
     return(DotNetImpl.IsNegativeInfinity(Bits));
 }
Beispiel #14
0
 public Boolean IsNaN()
 {
     return(DotNetImpl.IsNaN(Bits));
 }
Beispiel #15
0
 public Boolean IsNull()
 {
     return(DotNetImpl.IsNull(Bits));
 }
Beispiel #16
0
 public Decimal ToDecimal()
 {
     return(DotNetImpl.ToDecimal(ToUnderlying()));
 }
Beispiel #17
0
 public static Decimal64 FromDecimal(Decimal value)
 {
     return(new Decimal64(DotNetImpl.FromDecimal(value)));
 }
Beispiel #18
0
 public Boolean IsNonZero()
 {
     return(!DotNetImpl.IsZero(Bits));
 }
Beispiel #19
0
 public static Decimal64 FromUInt(uint value)
 {
     return(new Decimal64(DotNetImpl.FromUInt32(value)));
 }