Struct
Decimal
struct decimal
Module: System
Assembly: System.Runtime.dll
Source file: Decimal.rvn
Inheritance: Object → ValueType → Decimal
Implements: EquatableTo<Decimal>, Formattable, Number
An exact base-ten value with a 96-bit coefficient and scale from zero through 28. Arithmetic rounds discarded digits to even and faults on overflow or division by zero.
Constructors
4 items
Decimal(lo: int, mid: int, hi: int, isNegative: bool, scale: byte)
Creates a value from the three coefficient words, sign and scale; scale above 28 faults.
Decimal(value: int)
Creates an exact integral value.
Decimal(value: long)
Creates an exact signed integral value, including Int64.MinValue.
Decimal(value: ulong)
Creates an exact unsigned integral value.
Properties
6 items
Static member:
MaxValue: decimal
The largest representable value: 79228162514264337593543950335.
Static member:
MinusOne: decimal
Negative one.
Static member:
MinValue: decimal
The smallest representable value: -79228162514264337593543950335.
Static member:
One: decimal
The multiplicative identity.
Scale: byte
Number of fractional decimal places retained in the representation.
Static member:
Zero: decimal
The additive identity.
Methods
24 items
Static member:
Abs(value: decimal) -> decimal
Returns the absolute value, clearing the sign of negative zero too.
Static member:
Ceiling(value: decimal) -> decimal
Returns the smallest integral value no less than the input.
CompareTo(other: Self) -> int
Compares this value with the other value; returns a negative integer, zero or a positive integer for less than, equal to or greater than.
Required implementation (no default). Defined by ComparableTo<Self>.CompareTo · Defined by ComparableTo<Self>.CompareTo
CompareTo(other: decimal) -> int
Orders values without rounding or conversion to binary floating point.
Equals(other: decimal) -> bool
Compares numerical values; equivalent scales and either signed zero are equal.
Implements EquatableTo<Decimal>.Equals
Equals(other: object?) -> bool
Compares a boxed Decimal using numerical value equality.
Overrides Object.Equals
Static member:
Floor(value: decimal) -> decimal
Returns the largest integral value no greater than the input.
Static member:
GetBits(value: decimal, destination: Slice<int>) -> int
Writes four representation words without allocation; a shorter destination faults.
Static member:
GetBits(value: decimal) -> int[]
Returns independent low, middle, high and flags words, matching Decimal.GetBits ordering.
GetHashCode() -> int
Returns a value hash independent of equivalent scale and signed-zero encodings.
Overrides Object.GetHashCode
GetType() -> TypeInfo
Returns metadata for the concrete runtime type of this instance.
Inherited from Object.GetType
Static member:
IsNegative(value: decimal) -> bool
Tests the stored sign, including negative zero.
Static member:
IsZero(value: decimal) -> bool
Tests numerical zero, independently of sign and scale.
Static member:
Negate(value: decimal) -> decimal
Changes the sign while preserving coefficient and scale.
Static member:
Parse(text: string, culture: Culture) -> Result<decimal, NumberParseError>
Parses explicit culture punctuation using the shared strict grouping policy.
Static member:
Parse(text: string) -> Result<decimal, NumberParseError>
Parses strict invariant decimal text with an optional sign and decimal point. Whitespace, exponent notation and group separators are not accepted.
Static member:
Round(value: decimal, decimals: int) -> decimal
Rounds to 0–28 fractional places using nearest, ties-to-even; invalid precision faults.
Static member:
Round(value: decimal) -> decimal
Rounds to an integral value using nearest, ties-to-even.
ToString(format: string, culture: Culture) -> string
Formats G/G0, F, N or C with an explicit culture; unsupported formats fault.
Implements Formattable.ToString
ToString(format: string) -> string
Formats G/G0, F, N or C with Culture.Current; F/N precision is 0–99.
ToString() -> string
Formats invariant general decimal text, preserving the stored scale.
Overrides Object.ToString
Static member:
Truncate(value: decimal) -> decimal
Removes the fractional part toward zero.
Static member:
TryParse(text: string?, culture: Culture, result: out decimal) -> bool
Tries explicit-culture parsing; failure sets result to zero.
Static member:
TryParse(text: string?, result: out decimal) -> bool
Tries invariant parsing; failure sets result to zero.
Operators
17 items
Static member:
operator +(left: decimal, right: decimal) -> decimal
No summary available.
Static member:
operator /(left: decimal, right: decimal) -> decimal
No summary available.
Static member:
operator ==(left: decimal, right: decimal) -> bool
No summary available.
Static member:
operator >(left: decimal, right: decimal) -> bool
No summary available.
Static member:
operator >=(left: decimal, right: decimal) -> bool
No summary available.
Static member:
implicit conversion(value: int) -> decimal
Converts an Int32 exactly.
Static member:
implicit conversion(value: long) -> decimal
Converts an Int64 exactly.
Static member:
implicit conversion(value: uint) -> decimal
Converts a UInt32 exactly.
Static member:
implicit conversion(value: ulong) -> decimal
Converts a UInt64 exactly.
Static member:
operator !=(left: decimal, right: decimal) -> bool
No summary available.
Static member:
operator <(left: decimal, right: decimal) -> bool
No summary available.
Static member:
operator <=(left: decimal, right: decimal) -> bool
No summary available.
Static member:
operator %(left: decimal, right: decimal) -> decimal
No summary available.
Static member:
operator *(left: decimal, right: decimal) -> decimal
Multiplies exact coefficients, rounding only when the result needs a smaller scale.
Static member:
operator -(left: decimal, right: decimal) -> decimal
No summary available.
Static member:
operator -(value: decimal) -> decimal
No summary available.
Static member:
operator +(value: decimal) -> decimal
No summary available.