Struct Decimal128
Represents a Decimal128 value.
[Serializable]
public struct Decimal128 : IConvertible, IComparable<Decimal128>, IEquatable<Decimal128>
- Implements
- Inherited Members
- Extension Methods
Constructors
Decimal128(decimal)
Initializes a new instance of the Decimal128 struct.
public Decimal128(decimal value)
Parameters
value
decimalThe value.
Decimal128(double)
Initializes a new instance of the Decimal128 struct.
public Decimal128(double value)
Parameters
value
doubleThe value.
Decimal128(int)
Initializes a new instance of the Decimal128 struct.
public Decimal128(int value)
Parameters
value
intThe value.
Decimal128(long)
Initializes a new instance of the Decimal128 struct.
public Decimal128(long value)
Parameters
value
longThe value.
Decimal128(float)
Initializes a new instance of the Decimal128 struct.
public Decimal128(float value)
Parameters
value
floatThe value.
Decimal128(uint)
Initializes a new instance of the Decimal128 struct.
[CLSCompliant(false)]
public Decimal128(uint value)
Parameters
value
uintThe value.
Decimal128(ulong)
Initializes a new instance of the Decimal128 struct.
[CLSCompliant(false)]
public Decimal128(ulong value)
Parameters
value
ulongThe value.
Properties
MaxValue
Gets the maximum value.
public static Decimal128 MaxValue { get; }
Property Value
MinValue
Gets the minimum value.
public static Decimal128 MinValue { get; }
Property Value
NegativeInfinity
Represents negative infinity.
public static Decimal128 NegativeInfinity { get; }
Property Value
One
Represents one.
public static Decimal128 One { get; }
Property Value
PositiveInfinity
Represents positive infinity.
public static Decimal128 PositiveInfinity { get; }
Property Value
QNaN
Represents a value that is not a number.
public static Decimal128 QNaN { get; }
Property Value
SNaN
Represents a value that is not a number and raises errors when used in calculations.
public static Decimal128 SNaN { get; }
Property Value
Zero
Represents zero.
public static Decimal128 Zero { get; }
Property Value
Methods
Compare(Decimal128, Decimal128)
Compares two specified Decimal128 values and returns an integer that indicates whether the first value is greater than, less than, or equal to the second value.
public static int Compare(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first value.
y
Decimal128The second value.
Returns
- int
Less than zero if x < y, zero if x == y, and greater than zero if x > y.
CompareTo(Decimal128)
public int CompareTo(Decimal128 other)
Parameters
other
Decimal128
Returns
Equals(Decimal128)
public bool Equals(Decimal128 other)
Parameters
other
Decimal128
Returns
Equals(Decimal128, Decimal128)
Determines whether the specified Decimal128 instances are considered equal.
public static bool Equals(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first Decimal128 object to compare.
y
Decimal128The second Decimal128 object to compare.
Returns
- bool
True if the objects are considered equal; otherwise false. If both x and y are null, the method returns true.
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
FromComponents(bool, short, ulong, ulong)
Creates a new Decimal128 value from its components.
[CLSCompliant(false)]
public static Decimal128 FromComponents(bool isNegative, short exponent, ulong significandHighBits, ulong significandLowBits)
Parameters
isNegative
boolif set to
true
[is negative].exponent
shortThe exponent.
significandHighBits
ulongThe signficand high bits.
significandLowBits
ulongThe significand low bits.
Returns
- Decimal128
A Decimal128 value.
FromIEEEBits(ulong, ulong)
Creates a new Decimal128 value from the IEEE encoding bits.
[CLSCompliant(false)]
public static Decimal128 FromIEEEBits(ulong highBits, ulong lowBits)
Parameters
Returns
- Decimal128
A Decimal128 value.
GetExponent(Decimal128)
Gets the exponent of a Decimal128 value.
public static short GetExponent(Decimal128 d)
Parameters
d
Decimal128The Decimal128 value.
Returns
- short
The exponent.
GetHashCode()
public override int GetHashCode()
Returns
GetIEEEHighBits()
Gets the high order 64 bits of the binary representation of this instance.
[CLSCompliant(false)]
public ulong GetIEEEHighBits()
Returns
- ulong
The high order 64 bits of the binary representation of this instance.
GetIEEELowBits()
Gets the low order 64 bits of the binary representation of this instance.
[CLSCompliant(false)]
public ulong GetIEEELowBits()
Returns
- ulong
The low order 64 bits of the binary representation of this instance.
GetSignificandHighBits(Decimal128)
Gets the high bits of the significand of a Decimal128 value.
[CLSCompliant(false)]
public static ulong GetSignificandHighBits(Decimal128 d)
Parameters
d
Decimal128The Decimal128 value.
Returns
- ulong
The high bits of the significand.
GetSignificandLowBits(Decimal128)
Gets the high bits of the significand of a Decimal128 value.
[CLSCompliant(false)]
public static ulong GetSignificandLowBits(Decimal128 d)
Parameters
d
Decimal128The Decimal128 value.
Returns
- ulong
The high bits of the significand.
IsInfinity(Decimal128)
Returns a value indicating whether the specified number evaluates to negative or positive infinity.
public static bool IsInfinity(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
evaluates to negative or positive infinity; otherwise, false.
IsNaN(Decimal128)
Returns a value indicating whether the specified number is not a number.
public static bool IsNaN(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
is not a number; otherwise, false.
IsNegative(Decimal128)
Returns a value indicating whether the specified number is negative.
public static bool IsNegative(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
is negative; otherwise, false.
IsNegativeInfinity(Decimal128)
Returns a value indicating whether the specified number evaluates to negative infinity.
public static bool IsNegativeInfinity(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
evaluates to negative infinity; otherwise, false.
IsPositiveInfinity(Decimal128)
Returns a value indicating whether the specified number evaluates to positive infinity.
public static bool IsPositiveInfinity(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
evaluates to positive infinity; otherwise, false.
IsQNaN(Decimal128)
Returns a value indicating whether the specified number is a quiet not a number.
public static bool IsQNaN(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
is a quiet not a number; otherwise, false.
IsSNaN(Decimal128)
Returns a value indicating whether the specified number is a signaled not a number.
public static bool IsSNaN(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true if
d
is a signaled not a number; otherwise, false.
IsZero(Decimal128)
Returns a value indicating whether the specified number is zero.
public static bool IsZero(Decimal128 d)
Parameters
d
Decimal128A 128-bit decimal.
Returns
- bool
true
if the specified number is zero; otherwise,false
.
Negate(Decimal128)
Negates the specified x.
public static Decimal128 Negate(Decimal128 x)
Parameters
x
Decimal128The x.
Returns
- Decimal128
The result of multiplying the value by negative one.
Parse(string)
Converts the string representation of a number to its Decimal128 equivalent.
public static Decimal128 Parse(string s)
Parameters
s
stringThe string representation of the number to convert.
Returns
- Decimal128
The equivalent to the number contained in
s
.
ToByte(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 8-bit unsigned integer.
public static byte ToByte(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- byte
A 8-bit unsigned integer equivalent to
d
.
ToDecimal(Decimal128)
Converts the value of the specified Decimal128 to the equivalent decimal.
public static decimal ToDecimal(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
ToDouble(Decimal128)
Converts the value of the specified Decimal128 to the equivalent double.
public static double ToDouble(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
ToInt16(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 16-bit signed integer.
public static short ToInt16(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- short
A 16-bit signed integer equivalent to
d
.
ToInt32(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 32-bit signed integer.
public static int ToInt32(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- int
A 32-bit signed integer equivalent to
d
.
ToInt64(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 64-bit signed integer.
public static long ToInt64(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- long
A 64-bit signed integer equivalent to
d
.
ToSByte(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 8-bit signed integer.
[CLSCompliant(false)]
public static sbyte ToSByte(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- sbyte
A 8-bit signed integer equivalent to
d
.
ToSingle(Decimal128)
Converts the value of the specified Decimal128 to the equivalent float.
public static float ToSingle(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
ToString()
public override string ToString()
Returns
ToUInt16(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 16-bit unsigned integer.
[CLSCompliant(false)]
public static ushort ToUInt16(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- ushort
A 16-bit unsigned integer equivalent to
d
.
ToUInt32(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 32-bit unsigned integer.
[CLSCompliant(false)]
public static uint ToUInt32(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- uint
A 32-bit unsigned integer equivalent to
d
.
ToUInt64(Decimal128)
Converts the value of the specified Decimal128 to the equivalent 64-bit unsigned integer.
[CLSCompliant(false)]
public static ulong ToUInt64(Decimal128 d)
Parameters
d
Decimal128The number to convert.
Returns
- ulong
A 64-bit unsigned integer equivalent to
d
.
TryParse(string, out Decimal128)
Converts the string representation of a number to its Decimal128 equivalent. A return value indicates whether the conversion succeeded or failed.
public static bool TryParse(string s, out Decimal128 result)
Parameters
s
stringThe string representation of the number to convert.
result
Decimal128When this method returns, contains the Decimal128 number that is equivalent to the numeric value contained in
s
, if the conversion succeeded, or is zero if the conversion failed. The conversion fails if thes
parameter is null, is not a number in a valid format, or represents a number less than the min value or greater than the max value. This parameter is passed uninitialized.
Returns
- bool
true if
s
was converted successfully; otherwise, false.
Operators
operator ==(Decimal128, Decimal128)
Implements the operator ==.
public static bool operator ==(Decimal128 lhs, Decimal128 rhs)
Parameters
lhs
Decimal128The LHS.
rhs
Decimal128The RHS.
Returns
- bool
The result of the operator.
explicit operator byte(Decimal128)
Performs an explicit conversion from Decimal128 to byte.
public static explicit operator byte(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- byte
The result of the conversion.
explicit operator char(Decimal128)
Performs an explicit conversion from Decimal128 to char.
public static explicit operator char(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- char
The result of the conversion.
explicit operator decimal(Decimal128)
Performs an explicit conversion from Decimal128 to decimal.
public static explicit operator decimal(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- decimal
The result of the conversion.
explicit operator double(Decimal128)
Performs an explicit conversion from Decimal128 to double.
public static explicit operator double(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- double
The result of the conversion.
explicit operator short(Decimal128)
Performs an explicit conversion from Decimal128 to short.
public static explicit operator short(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- short
The result of the conversion.
explicit operator int(Decimal128)
Performs an explicit conversion from Decimal128 to int.
public static explicit operator int(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- int
The result of the conversion.
explicit operator long(Decimal128)
Performs an explicit conversion from Decimal128 to long.
public static explicit operator long(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- long
The result of the conversion.
explicit operator sbyte(Decimal128)
Performs an explicit conversion from Decimal128 to sbyte.
[CLSCompliant(false)]
public static explicit operator sbyte(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- sbyte
The result of the conversion.
explicit operator float(Decimal128)
Performs an explicit conversion from Decimal128 to float.
public static explicit operator float(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- float
The result of the conversion.
explicit operator ushort(Decimal128)
Performs an explicit conversion from Decimal128 to ushort.
[CLSCompliant(false)]
public static explicit operator ushort(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- ushort
The result of the conversion.
explicit operator uint(Decimal128)
Performs an explicit conversion from Decimal128 to uint.
[CLSCompliant(false)]
public static explicit operator uint(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- uint
The result of the conversion.
explicit operator ulong(Decimal128)
Performs an explicit conversion from Decimal128 to ulong.
[CLSCompliant(false)]
public static explicit operator ulong(Decimal128 value)
Parameters
value
Decimal128The value to convert.
Returns
- ulong
The result of the conversion.
explicit operator Decimal128(double)
Performs an explicit conversion from double to Decimal128.
public static explicit operator Decimal128(double value)
Parameters
value
doubleThe value.
Returns
- Decimal128
The result of the conversion.
explicit operator Decimal128(float)
Performs an explicit conversion from float to Decimal128.
public static explicit operator Decimal128(float value)
Parameters
value
floatThe value.
Returns
- Decimal128
The result of the conversion.
operator >(Decimal128, Decimal128)
Returns a value indicating whether a specified Decimal128 is greater than another specified Decimal128.
public static bool operator >(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first value.
y
Decimal128The second value.
Returns
- bool
true if x > y; otherwise, false.
operator >=(Decimal128, Decimal128)
Returns a value indicating whether a specified Decimal128 is greater than or equal to another another specified Decimal128.
public static bool operator >=(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first value.
y
Decimal128The second value.
Returns
- bool
true if x >= y; otherwise, false.
implicit operator Decimal128(byte)
Performs an implicit conversion from byte to Decimal128.
public static implicit operator Decimal128(byte value)
Parameters
value
byteThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(decimal)
Performs an implicit conversion from decimal to Decimal128.
public static implicit operator Decimal128(decimal value)
Parameters
value
decimalThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(short)
Performs an implicit conversion from short to Decimal128.
public static implicit operator Decimal128(short value)
Parameters
value
shortThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(int)
Performs an implicit conversion from int to Decimal128.
public static implicit operator Decimal128(int value)
Parameters
value
intThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(long)
Performs an implicit conversion from long to Decimal128.
public static implicit operator Decimal128(long value)
Parameters
value
longThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(sbyte)
Performs an implicit conversion from sbyte to Decimal128.
[CLSCompliant(false)]
public static implicit operator Decimal128(sbyte value)
Parameters
value
sbyteThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(ushort)
Performs an implicit conversion from ushort to Decimal128.
[CLSCompliant(false)]
public static implicit operator Decimal128(ushort value)
Parameters
value
ushortThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(uint)
Performs an implicit conversion from uint to Decimal128.
[CLSCompliant(false)]
public static implicit operator Decimal128(uint value)
Parameters
value
uintThe value.
Returns
- Decimal128
The result of the conversion.
implicit operator Decimal128(ulong)
Performs an implicit conversion from ulong to Decimal128.
[CLSCompliant(false)]
public static implicit operator Decimal128(ulong value)
Parameters
value
ulongThe value.
Returns
- Decimal128
The result of the conversion.
operator !=(Decimal128, Decimal128)
Implements the operator !=.
public static bool operator !=(Decimal128 lhs, Decimal128 rhs)
Parameters
lhs
Decimal128The LHS.
rhs
Decimal128The RHS.
Returns
- bool
The result of the operator.
operator <(Decimal128, Decimal128)
Returns a value indicating whether a specified Decimal128 is less than another specified Decimal128.
public static bool operator <(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first value.
y
Decimal128The second value.
Returns
- bool
true if x < y; otherwise, false.
operator <=(Decimal128, Decimal128)
Returns a value indicating whether a specified Decimal128 is less than or equal to another another specified Decimal128.
public static bool operator <=(Decimal128 x, Decimal128 y)
Parameters
x
Decimal128The first value.
y
Decimal128The second value.
Returns
- bool
true if x <= y; otherwise, false.