Table of Contents

Struct Decimal128

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

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 decimal

The value.

Decimal128(double)

Initializes a new instance of the Decimal128 struct.

public Decimal128(double value)

Parameters

value double

The value.

Decimal128(int)

Initializes a new instance of the Decimal128 struct.

public Decimal128(int value)

Parameters

value int

The value.

Decimal128(long)

Initializes a new instance of the Decimal128 struct.

public Decimal128(long value)

Parameters

value long

The value.

Decimal128(float)

Initializes a new instance of the Decimal128 struct.

public Decimal128(float value)

Parameters

value float

The value.

Decimal128(uint)

Initializes a new instance of the Decimal128 struct.

[CLSCompliant(false)]
public Decimal128(uint value)

Parameters

value uint

The value.

Decimal128(ulong)

Initializes a new instance of the Decimal128 struct.

[CLSCompliant(false)]
public Decimal128(ulong value)

Parameters

value ulong

The value.

Properties

MaxValue

Gets the maximum value.

public static Decimal128 MaxValue { get; }

Property Value

Decimal128

MinValue

Gets the minimum value.

public static Decimal128 MinValue { get; }

Property Value

Decimal128

NegativeInfinity

Represents negative infinity.

public static Decimal128 NegativeInfinity { get; }

Property Value

Decimal128

One

Represents one.

public static Decimal128 One { get; }

Property Value

Decimal128

PositiveInfinity

Represents positive infinity.

public static Decimal128 PositiveInfinity { get; }

Property Value

Decimal128

QNaN

Represents a value that is not a number.

public static Decimal128 QNaN { get; }

Property Value

Decimal128

SNaN

Represents a value that is not a number and raises errors when used in calculations.

public static Decimal128 SNaN { get; }

Property Value

Decimal128

Zero

Represents zero.

public static Decimal128 Zero { get; }

Property Value

Decimal128

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 Decimal128

The first value.

y Decimal128

The 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

int

Equals(Decimal128)

public bool Equals(Decimal128 other)

Parameters

other Decimal128

Returns

bool

Equals(Decimal128, Decimal128)

Determines whether the specified Decimal128 instances are considered equal.

public static bool Equals(Decimal128 x, Decimal128 y)

Parameters

x Decimal128

The first Decimal128 object to compare.

y Decimal128

The 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

bool

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 bool

if set to true [is negative].

exponent short

The exponent.

significandHighBits ulong

The signficand high bits.

significandLowBits ulong

The 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

highBits ulong

The high bits.

lowBits ulong

The low bits.

Returns

Decimal128

A Decimal128 value.

GetExponent(Decimal128)

Gets the exponent of a Decimal128 value.

public static short GetExponent(Decimal128 d)

Parameters

d Decimal128

The Decimal128 value.

Returns

short

The exponent.

GetHashCode()

public override int GetHashCode()

Returns

int

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 Decimal128

The 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 Decimal128

The 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

A 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 Decimal128

The 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 string

The 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 Decimal128

The 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 Decimal128

The number to convert.

Returns

decimal

A decimal equivalent to d.

ToDouble(Decimal128)

Converts the value of the specified Decimal128 to the equivalent double.

public static double ToDouble(Decimal128 d)

Parameters

d Decimal128

The number to convert.

Returns

double

A double equivalent to d.

ToInt16(Decimal128)

Converts the value of the specified Decimal128 to the equivalent 16-bit signed integer.

public static short ToInt16(Decimal128 d)

Parameters

d Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The number to convert.

Returns

float

A float equivalent to d.

ToString()

public override string ToString()

Returns

string

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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 string

The string representation of the number to convert.

result Decimal128

When 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 the s 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 Decimal128

The LHS.

rhs Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 Decimal128

The 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 double

The 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 float

The 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 Decimal128

The first value.

y Decimal128

The 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 Decimal128

The first value.

y Decimal128

The 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 byte

The 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 decimal

The 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 short

The 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 int

The 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 long

The 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 sbyte

The 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 ushort

The 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 uint

The 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 ulong

The value.

Returns

Decimal128

The result of the conversion.

operator !=(Decimal128, Decimal128)

Implements the operator !=.

public static bool operator !=(Decimal128 lhs, Decimal128 rhs)

Parameters

lhs Decimal128

The LHS.

rhs Decimal128

The 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 Decimal128

The first value.

y Decimal128

The 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 Decimal128

The first value.

y Decimal128

The second value.

Returns

bool

true if x <= y; otherwise, false.