Repository navigation
OnixLabs.Numerics.BigDecimalOrdinalityComparer
Provides ordinal (ordering) comparison for BigDecimal values. The single instance is available via the Default field. Ordering is always semantic, comparing the underlying numeric values regardless of scale.
| Namespace | OnixLabs.Numerics |
| Assembly | OnixLabs.Numerics.dll (NuGet) |
| Inheritance |
object → BigDecimalOrdinalityComparer
|
| Implements |
IComparer<BigDecimal>, IComparer
|
public sealed class BigDecimalOrdinalityComparer : IComparer<BigDecimal>, IComparerBigDecimalOrdinalityComparer compares BigDecimal values by their numeric value. Comparison is delegated to NumberInfoOrdinalityComparer.Default, which aligns the two values to a common scale before comparing their unscaled integers.
The constructor is private; the only available instance is Default.
| Member | Type | Description |
|---|---|---|
Default |
BigDecimalOrdinalityComparer |
The single shared instance of the ordinal comparer. |
public static readonly BigDecimalOrdinalityComparer Default;The default ordinal comparer for BigDecimal values. This is the only publicly accessible instance; the constructor is private.
| Method | Returns | Description |
|---|---|---|
Compare(BigDecimal, BigDecimal) |
int |
Compares two BigDecimal values by numeric value. |
Compare(object?, object?) |
int |
Compares two objects assumed to be BigDecimal values. |
IsEqual(BigDecimal, BigDecimal) |
bool |
Returns true if the two values are numerically equal. |
IsGreaterThan(BigDecimal, BigDecimal) |
bool |
Returns true if left is greater than right. |
IsGreaterThanOrEqual(BigDecimal, BigDecimal) |
bool |
Returns true if left is greater than or equal to right. |
IsLessThan(BigDecimal, BigDecimal) |
bool |
Returns true if left is less than right. |
IsLessThanOrEqual(BigDecimal, BigDecimal) |
bool |
Returns true if left is less than or equal to right. |
public int Compare(BigDecimal x, BigDecimal y)Compares two BigDecimal values and returns a signed integer indicating their relative order. Delegates to NumberInfoOrdinalityComparer.Default.
| Parameter | Type | Description |
|---|---|---|
x |
BigDecimal |
The first value to compare. |
y |
BigDecimal |
The second value to compare. |
Returns — A negative integer if x < y, zero if x == y, or a positive integer if x > y.
public int Compare(object? x, object? y)Compares two objects. Both must be BigDecimal values.
| Parameter | Type | Description |
|---|---|---|
x |
object? |
The first value to compare. |
y |
object? |
The second value to compare. |
Returns — A signed integer indicating the relative order of the two values.
Exceptions
| Exception | Condition |
|---|---|
ArgumentException |
x or y is not of type BigDecimal. |
public bool IsEqual(BigDecimal left, BigDecimal right)Returns — true if left and right are numerically equal; otherwise, false.
public bool IsGreaterThan(BigDecimal left, BigDecimal right)Returns — true if left is greater than right; otherwise, false.
public bool IsGreaterThanOrEqual(BigDecimal left, BigDecimal right)Returns — true if left is greater than or equal to right; otherwise, false.
public bool IsLessThan(BigDecimal left, BigDecimal right)Returns — true if left is less than right; otherwise, false.
public bool IsLessThanOrEqual(BigDecimal left, BigDecimal right)Returns — true if left is less than or equal to right; otherwise, false.
ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions