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
value
decimalDecimal value.
BigDecimal(BigInteger, short)
Initializes a new instance of the BigDecimal struct.
public BigDecimal(BigInteger unscaledValue, short scale)
Parameters
unscaledValue
BigIntegerUnscaled value.
scale
shortScale.
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
other
BigDecimalAn 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 other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in 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
obj
objectAn 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 obj
in the sort order.Zero This instance occurs in the same position in the sort order as obj
.Greater than zero This instance follows obj
in the sort order.
Exceptions
- ArgumentException
obj
is 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
provider
IFormatProviderAn 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
format
stringThe format to use.
-or-
A null reference (
Nothing
in Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProvider
IFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothing
in 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
left
BigDecimalright
BigDecimal
Returns
operator >=(BigDecimal, BigDecimal)
public static bool operator >=(BigDecimal left, BigDecimal right)
Parameters
left
BigDecimalright
BigDecimal
Returns
operator <(BigDecimal, BigDecimal)
public static bool operator <(BigDecimal left, BigDecimal right)
Parameters
left
BigDecimalright
BigDecimal
Returns
operator <=(BigDecimal, BigDecimal)
public static bool operator <=(BigDecimal left, BigDecimal right)
Parameters
left
BigDecimalright
BigDecimal