Tree3.Calculator
1.0.0
See the version list below for details.
dotnet add package Tree3.Calculator --version 1.0.0
NuGet\Install-Package Tree3.Calculator -Version 1.0.0
<PackageReference Include="Tree3.Calculator" Version="1.0.0" />
<PackageVersion Include="Tree3.Calculator" Version="1.0.0" />
<PackageReference Include="Tree3.Calculator" />
paket add Tree3.Calculator --version 1.0.0
#r "nuget: Tree3.Calculator, 1.0.0"
#:package Tree3.Calculator@1.0.0
#addin nuget:?package=Tree3.Calculator&version=1.0.0
#tool nuget:?package=Tree3.Calculator&version=1.0.0
Tree3.Calculator
Tree3.Calculator is a lightweight .NET 9.0 library that provides asynchronous, high-precision non-negative integer arithmetic operations.
It defines a clean abstraction for performing addition, subtraction, multiplication, division, and modulo operations on arbitrarily large non-negative integers represented as strings.
Features
- Asynchronous API � all operations return
Task<string>, ready for use in async workflows. - Arbitrary-precision integer support � operands are passed as strings, enabling calculations with values larger than
longlimits. - Simple, extensible interface � easy to implement with any numeric backend (e.g.,
BigInteger, external calculator service, or distributed computation engine). - Consistent method naming � unified API for addition, subtraction, multiplication, division, and modulo.
- Serialization-friendly � string inputs/outputs integrate seamlessly with JSON APIs and network-based systems.
- Testable and mockable � ideal for dependency injection and unit testing scenarios.
- Cross-platform � built for .NET 9.0, works on Windows, Linux, and macOS.
Usage
using Tree3.Converter;
var calculator = new DecimalCalculator();
string sum = await calculator.AddAsync("12345", "1");
// Output: "123456"
string product = await calculator.MultiplyAsync("12345", "1");
// Output: "12345"
string invalid = await calculator.DivideAsync("12345", "-a1");
// Output: "N/A"
using Tree3.Converter;
var calculator = new BinaryCalculator();
string sum = await calculator.AddAsync("10", "1");
// Output: "11"
string product = await calculator.MultiplyAsync("10", "11");
// Output: "110"
string invalid = await calculator.SubtractAsync("11011", "abc");
// Output: "N/A"
Performance
NET 9 / Windows 11 / Intel i5 CPU
Addition: adds two decimal integers with 100,000 digits in ~0.9 seconds
Subtraction: subtracts two decimal integers with 100,000 digits in ~0.9 seconds
Multiplication: multiplies two decimal integers with 100,000 digits in ~2.9 seconds
Division: divides two decimal integers with 100,000 / 50,000 digits in ~0.4 seconds
Modulo: computes remainder of two decimal integers with 100,000 / 50,000 digits in ~0.4 seconds
Addition: adds two binary integers with 100,000 digits in ~2.8 seconds
Subtraction: subtracts two binary integers with 100,000 digits in ~1.2 seconds
Multiplication: multiplies two binary integers with 100,000 digits in ~5 seconds
Division: divides two binary integers with 100,000 / 50,000 digits in ~1.2 seconds
Modulo: computes remainder of two binary integers with 100,000 / 50,000 digits in ~1.2 seconds
Release Notes
v1.0.0 � 2025-11-12
Initial release of Tree3.Calculator
- Added
ICalculatorinterface for asynchronous non-negative integer arithmetic. - Supported operations:
AddAsync(string firstAddend, string secondAddend)SubtractAsync(string minuend, string subtrahend)MultiplyAsync(string firstFactor, string secondFactor)DivideAsync(string dividend, string divisor)ModAsync(string dividend, string divisor)
- All methods return results as
stringvalues, allowing support for very large numbers. - Compatible with .NET 9.0.
- Designed for extensibility and dependency injection.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
-
net9.0
- Tree3.Converter (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added `ICalculator` interface for asynchronous non-negative integer arithmetic.
- Supported operations:
- `AddAsync(string firstAddend, string secondAddend)`
- `SubtractAsync(string minuend, string subtrahend)`
- `MultiplyAsync(string firstFactor, string secondFactor)`
- `DivideAsync(string dividend, string divisor)`
- `ModAsync(string dividend, string divisor)`
- All methods return results as `string` values, allowing support for very large numbers.
- Compatible with .NET 9.0.
- Designed for extensibility and dependency injection.