Repository navigation
OnixLabs.Numerics
Matthew Layton edited this page Nov 15, 2026
·
5 revisions
High-precision numeric types and generic math utilities for scenarios where the built-in numeric types are insufficient. This package emphasizes correctness, precision, and introspection of numeric values.
dotnet add package OnixLabs.Numerics- Arbitrary-precision
BigDecimalbuilt on generic math (IFloatingPoint<T>). - Extended-width integer types (
Int256,UInt256,Int512,UInt512). - Extended-precision floating-point types (
Float128,Float256). -
NumberInfofor dissecting rational numbers into their constituent parts. - Generic math helpers (
GenericMath) over the BCL numeric interfaces (INumber<T>,IBinaryInteger<T>). - Extension methods for
Decimal,BigDecimal,BigInteger, and other numeric types.
All types are in the OnixLabs.Numerics namespace.
| Type | Description |
|---|---|
| BigDecimal | Arbitrary-precision decimal built on generic math, with strict and semantic equality. |
| BigDecimalEqualityComparer | Strict/semantic equality comparer for BigDecimal. |
| BigDecimalOrdinalityComparer | Ordinal comparer for BigDecimal. |
| NumberInfo | Dissects a rational number into its constituent parts (unscaled value, scale, significand, exponent, sign, precision). |
| NumberInfoEqualityComparer | Strict/semantic equality comparer for NumberInfo. |
| NumberInfoOrdinalityComparer | Ordinal comparer for NumberInfo. |
| Type | Description |
|---|---|
| Int256 | 256-bit signed integer with full IBinaryInteger<T> / ISignedNumber<T> generic-math support. |
| Int512 | 512-bit signed integer. |
| UInt256 | 256-bit unsigned integer (IUnsignedNumber<T>). |
| UInt512 | 512-bit unsigned integer. |
| Type | Description |
|---|---|
| Float128 | 128-bit IEEE-754 binary floating-point (quad precision), IBinaryFloatingPointIeee754<T>. |
| Float256 | 256-bit IEEE-754 binary floating-point (octuple precision). |
| Type | Description |
|---|---|
| GenericMath | Generic mathematical helpers (Delta, Factorial, IntegerLength, MinMax, Pow, Pow10) over INumber<T> / IBinaryInteger<T>. |
| NumericsExtensions | Extension methods converting decimal, BigInteger, and other numeric types to BigDecimal, NumberInfo, and scaled values. |
| ConversionMode | Selects decimal vs binary interpretation when converting IEEE-754 values. |
| ScaleMode | Selects fractional vs integral scaling behaviour. |
| Item | Supported |
|---|---|
| Target frameworks | .NET 8.0, .NET 9.0, .NET 10.0, .NET 11.0 |
| Language version | C# 15 |
| License | Apache-2.0 |
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