Struct BigDecimal
Big decimal.
Ignite supports values with up to MaxValue precision (in tables, SQL, Compute, and other APIs). .NET decimal has 28-29 digit precision and can not represent all values that Ignite supports. This type fills the gap.public readonly record struct BigDecimal : IComparable<BigDecimal>, IComparable, IFormattable, IEquatable<BigDecimal>
- Implements
- Inherited Members
Constructors
BigDecimal(decimal)
Initializes a new instance of the BigDecimal struct.
public BigDecimal(decimal value)
Parameters
valuedecimalDecimal value.
BigDecimal(BigInteger, short)
Initializes a new instance of the BigDecimal struct.
public BigDecimal(BigInteger unscaledValue, short scale)
Parameters
unscaledValueBigIntegerUnscaled value.
scaleshortScale.
Properties
Scale
Gets the scale.
public short Scale { get; }
Property Value
UnscaledValue
Gets the unscaled value.
public BigInteger UnscaledValue { get; }
Property Value
Methods
CompareTo(BigDecimal)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(BigDecimal other)
Parameters
otherBigDecimalAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
ToDecimal()
Converts the value of this instance to its equivalent decimal representation.
public decimal ToDecimal()
Returns
- decimal
Decimal representation of the current value.
Exceptions
- OverflowException
Value was either too large or too small for a Decimal.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToString(IFormatProvider?)
Converts the numeric value of this object to its equivalent string representation.
public string ToString(IFormatProvider? provider)
Parameters
providerIFormatProviderAn object that supplies culture-specific formatting information.
Returns
- string
The string representation of the current value.
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
Operators
operator >(BigDecimal, BigDecimal)
public static bool operator >(BigDecimal left, BigDecimal right)
Parameters
leftBigDecimalrightBigDecimal
Returns
operator >=(BigDecimal, BigDecimal)
public static bool operator >=(BigDecimal left, BigDecimal right)
Parameters
leftBigDecimalrightBigDecimal
Returns
operator <(BigDecimal, BigDecimal)
public static bool operator <(BigDecimal left, BigDecimal right)
Parameters
leftBigDecimalrightBigDecimal
Returns
operator <=(BigDecimal, BigDecimal)
public static bool operator <=(BigDecimal left, BigDecimal right)
Parameters
leftBigDecimalrightBigDecimal