BigNumbersNet 1.1.1

dotnet add package BigNumbersNet --version 1.1.1
                    
NuGet\Install-Package BigNumbersNet -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BigNumbersNet" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BigNumbersNet" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="BigNumbersNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BigNumbersNet --version 1.1.1
                    
#r "nuget: BigNumbersNet, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BigNumbersNet@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BigNumbersNet&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=BigNumbersNet&version=1.1.1
                    
Install as a Cake Tool

BigNumbersNet

NuGet Version

An arbitrary-precision decimal and integer arithmetic library for .NET, facilitating calculations for exceptionally large numbers and high-precision fractions.

Features

  • Decimals & Integers: Full support for arbitrarily large integers and high-precision fractional decimals.
  • Immutable Data Type: Prevents unintended side-effects with thread-safe mathematical operations.
  • Full Operator Overloading: Seamlessly write expressions using standard operators (+, -, *, /, %, <, >, ==).
  • Standard Math Functions: Out-of-the-box support for Abs, Pow, Max, Min, and GreatestCommonDivisor (GCD).
  • Targeting Modern Frameworks: Optimized for both .NET 8 and .NET 10.

Installation

Install via the NuGet Package Manager:

dotnet add package BigNumbersNet

Quick Start

Basic Arithmetic & Decimals

using BigNumbersNet;

// Parsing large decimal and integer values
BigNumber val1 = BigNumber.Parse("98765432101234567890.123456");
BigNumber val2 = BigNumber.Parse("12345678901234567890.500000");

// Standard operations
BigNumber sum = val1 + val2;        // Automatically aligns scales
BigNumber difference = val1 - val2;
BigNumber product = val1 * val2;

Console.WriteLine($"Sum: {sum}");                 // Prints normalized decimal
Console.WriteLine($"Product: {product}");

Division Operators (Important Note)

Unlike standard C# integer types, the / operator in BigNumbersNet performs high-precision fractional division. If you require truncating integer division (similar to standard BigInteger), use the IntegerDivide method:

BigNumber numA = BigNumber.Parse("5");
BigNumber numB = BigNumber.Parse("2");

// 1. High-precision decimal division
BigNumber decimalQuotient = numA / numB; 
Console.WriteLine(decimalQuotient); // Outputs "2.5"

// 2. Truncating integer division
BigNumber integerQuotient = BigNumber.IntegerDivide(numA, numB);
Console.WriteLine(integerQuotient); // Outputs "2"

Advanced Math Operations

// Greatest Common Divisor (supported on integers)
BigNumber gcd = BigNumber.GreatestCommonDivisor(BigNumber.Parse("45"), BigNumber.Parse("30")); // 15

// Exponents
BigNumber raised = BigNumber.Pow(BigNumber.Parse("5.5"), 10);

Performance & Design Note

The library stores decimal digits internally in base-10 byte arrays to control allocations and memory mutations. While stable for mathematical assertions, it relies on schoolbook implementation algorithms. For cryptographically secure operations or heavy high-performance computations, we recommend reviewing performance against platform-standard System.Numerics.BigInteger.

License

This project is licensed under the GPL-3.0-or-later license.

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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
1.1.1 127 6/25/2026
1.0.2 110 6/25/2026