AWSSDK.Extensions.Numerics
4.0.0.2
Prefix Reserved
dotnet add package AWSSDK.Extensions.Numerics --version 4.0.0.2
NuGet\Install-Package AWSSDK.Extensions.Numerics -Version 4.0.0.2
<PackageReference Include="AWSSDK.Extensions.Numerics" Version="4.0.0.2" />
<PackageVersion Include="AWSSDK.Extensions.Numerics" Version="4.0.0.2" />
<PackageReference Include="AWSSDK.Extensions.Numerics" />
paket add AWSSDK.Extensions.Numerics --version 4.0.0.2
#r "nuget: AWSSDK.Extensions.Numerics, 4.0.0.2"
#:package AWSSDK.Extensions.Numerics@4.0.0.2
#addin nuget:?package=AWSSDK.Extensions.Numerics&version=4.0.0.2
#tool nuget:?package=AWSSDK.Extensions.Numerics&version=4.0.0.2
AWSSDK.Extensions.Numerics
This package provides BigDecimal, an immutable, arbitrary-precision signed decimal number for .NET. Unlike double it has no binary rounding error (it can represent 0.1 exactly), and unlike decimal it has no fixed digit limit. This makes it suitable for carrying high-precision numeric values — such as those exchanged with AWS services — without losing any digits.
A value is represented as an arbitrary-precision unscaled value (a System.Numerics.BigInteger) and a 32-bit integer scale, where the numeric value equals unscaledValue × 10^(-scale).
The type lives in the Amazon.Extensions.Numerics namespace.
Features
- Exact, arbitrary-precision arithmetic: add, subtract, multiply, divide, remainder, negate, and absolute value.
- Operator overloads (
+ - * / %, unary+/-) plus implicit conversions from the built-in numeric types, so mixed expressions likevalue + 10work naturally. - Numeric equality and comparison:
2.0equals2.00(note this differs from Java's scale-sensitiveBigDecimal.equals). - Configurable rounding via
MathContextandRoundingMode(modeled on Java'sBigDecimal). - Culture-aware parsing and formatting, with Java-style scientific notation for very large or very small magnitudes.
- On .NET 8 and later,
BigDecimalimplements the .NET Generic Math interfaces (INumber<BigDecimal>,ISignedNumber<BigDecimal>), so it can be used with generic constraints such aswhere T : INumber<T>.
Examples
Basic arithmetic
using Amazon.Extensions.Numerics;
var price = BigDecimal.Parse("19.99");
var quantity = new BigDecimal(3);
var total = price * quantity; // 59.97
total = total + 10; // 69.97 (int converts implicitly)
Division and rounding
By default, division requires an exact, terminating result and throws ArithmeticException otherwise (matching Java's BigDecimal.divide). For inexact division, supply a MathContext or an explicit scale and RoundingMode:
var exact = BigDecimal.Parse("10").Divide(BigDecimal.Parse("4")); // 2.5
// 1/3 does not terminate, so the parameterless Divide would throw.
// Provide precision and a rounding mode instead:
var approx = BigDecimal.Parse("1").Divide(
BigDecimal.Parse("3"),
new MathContext(5, RoundingMode.HalfUp)); // 0.33333
// Or round to a fixed scale:
var rounded = BigDecimal.Parse("10").Divide(
BigDecimal.Parse("3"), scale: 4, RoundingMode.HalfEven); // 3.3333
Parsing and formatting
using System.Globalization;
var value = BigDecimal.Parse("1.5E-10", CultureInfo.InvariantCulture);
string text = value.ToString(CultureInfo.InvariantCulture); // "1.5E-10"
string plain = value.ToPlainString(CultureInfo.InvariantCulture); // "0.00000000015"
if (BigDecimal.TryParse("123.45", CultureInfo.InvariantCulture, out var parsed))
{
// use parsed
}
Generic Math (.NET 8 and later)
using System.Numerics;
using Amazon.Extensions.Numerics;
static T Sum<T>(T a, T b) where T : INumber<T> => a + b;
var result = Sum(BigDecimal.Parse("2.5"), BigDecimal.Parse("2.5")); // 5
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0.2 | 104 | 7/28/2026 |