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))); }
/// <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))); }
public static Decimal64 FromFixedPoint(uint mantissa, int numberOfDigits) { return(new Decimal64(DotNetImpl.FromFixedPoint32(mantissa, numberOfDigits))); }
public Decimal64 Abs() { return(new Decimal64(DotNetImpl.Abs(Bits))); }
public static Decimal64 operator -(Decimal64 value) { return(new Decimal64(DotNetImpl.Negate(value.Bits))); }
public Decimal64 Negate() { return(new Decimal64(DotNetImpl.Negate(Bits))); }
public override String ToString() { return(DotNetImpl.ToString(Bits)); //return ((Double)this).ToString(CultureInfo.InvariantCulture); }
public Boolean IsZero() { return(DotNetImpl.IsZero(Bits)); }
public static Decimal64 FromDecimalDouble(Double value) { return(new Decimal64(DotNetImpl.FromDecimalFloat64(value))); }
public Boolean IsSigned() { return(DotNetImpl.SignBit(Bits)); }
public Boolean IsNegativeInfinity() { return(DotNetImpl.IsNegativeInfinity(Bits)); }
public Boolean IsNaN() { return(DotNetImpl.IsNaN(Bits)); }
public Boolean IsNull() { return(DotNetImpl.IsNull(Bits)); }
public Decimal ToDecimal() { return(DotNetImpl.ToDecimal(ToUnderlying())); }
public static Decimal64 FromDecimal(Decimal value) { return(new Decimal64(DotNetImpl.FromDecimal(value))); }
public Boolean IsFinite() { return(DotNetImpl.IsFinite(Bits)); }
public static Decimal64 FromUInt(uint value) { return(new Decimal64(DotNetImpl.FromUInt32(value))); }