示例#1
0
文件: Decimal64.cs 项目: noop-dev/DFP
 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)));
 }
示例#2
0
文件: Decimal64.cs 项目: noop-dev/DFP
 /// <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)));
 }
示例#3
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public static Decimal64 FromFixedPoint(uint mantissa, int numberOfDigits)
 {
     return(new Decimal64(DotNetImpl.FromFixedPoint32(mantissa, numberOfDigits)));
 }
示例#4
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Decimal64 Abs()
 {
     return(new Decimal64(DotNetImpl.Abs(Bits)));
 }
示例#5
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public static Decimal64 operator -(Decimal64 value)
 {
     return(new Decimal64(DotNetImpl.Negate(value.Bits)));
 }
示例#6
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Decimal64 Negate()
 {
     return(new Decimal64(DotNetImpl.Negate(Bits)));
 }
示例#7
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public override String ToString()
 {
     return(DotNetImpl.ToString(Bits));
     //return ((Double)this).ToString(CultureInfo.InvariantCulture);
 }
示例#8
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsZero()
 {
     return(DotNetImpl.IsZero(Bits));
 }
示例#9
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public static Decimal64 FromDecimalDouble(Double value)
 {
     return(new Decimal64(DotNetImpl.FromDecimalFloat64(value)));
 }
示例#10
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsSigned()
 {
     return(DotNetImpl.SignBit(Bits));
 }
示例#11
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsNegativeInfinity()
 {
     return(DotNetImpl.IsNegativeInfinity(Bits));
 }
示例#12
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsNaN()
 {
     return(DotNetImpl.IsNaN(Bits));
 }
示例#13
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsNull()
 {
     return(DotNetImpl.IsNull(Bits));
 }
示例#14
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Decimal ToDecimal()
 {
     return(DotNetImpl.ToDecimal(ToUnderlying()));
 }
示例#15
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public static Decimal64 FromDecimal(Decimal value)
 {
     return(new Decimal64(DotNetImpl.FromDecimal(value)));
 }
示例#16
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public Boolean IsFinite()
 {
     return(DotNetImpl.IsFinite(Bits));
 }
示例#17
0
文件: Decimal64.cs 项目: noop-dev/DFP
 public static Decimal64 FromUInt(uint value)
 {
     return(new Decimal64(DotNetImpl.FromUInt32(value)));
 }