BigReal 5.3.0
dotnet add package BigReal --version 5.3.0
NuGet\Install-Package BigReal -Version 5.3.0
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="BigReal" Version="5.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BigReal" Version="5.3.0" />
<PackageReference Include="BigReal" />
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 BigReal --version 5.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BigReal, 5.3.0"
#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 BigReal@5.3.0
#: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=BigReal&version=5.3.0
#tool nuget:?package=BigReal&version=5.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BigReal
An arbitrary size and precision rational number stored using two BigIntegers.
Usage
Create from fixed-size numbers:
Console.WriteLine(new BigReal(100)); // 100
Console.WriteLine((BigReal)3.14); // 3.14
Console.WriteLine(new BigReal(4, 3).ToString(4)); // 1.3333
Perform basic operations:
Console.WriteLine((BigReal)3 * (BigReal)5); // 15
Console.WriteLine(BigReal.Pow(3.4, 2)); // 11.559999999999999
Parse from string:
Console.WriteLine(BigReal.Parse("12.34")); // 12.34
Console.WriteLine(BigReal.Parse("2e2.5").ToString(2)); // 632.45
Trigonometry:
Console.WriteLine(BigReal.Sin(100).ToString(20)); // -0.5063656411097587906
Performance
Basic operations comparing BigReal, BigDecimal, and BigFloat:
Add:10 + 3Divide:10 / 3DivideToString:(10 / 3).ToString()Parse:Parse("12345.6789")FromFloat:123.45f
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| Add_BigReal | 20.342 ns | 0.0616 ns | 0.0514 ns | - | - |
| Add_BigDecimal | 373.701 ns | 2.4290 ns | 2.0284 ns | 0.0739 | 464 B |
| Add_BigFloat | 21.680 ns | 0.0568 ns | 0.0504 ns | - | - |
| Divide_BigReal | 9.109 ns | 0.0228 ns | 0.0190 ns | - | - |
| Divide_BigDecimal | 28,783.122 ns | 134.7718 ns | 112.5406 ns | 5.2185 | 32832 B |
| Divide_BigFloat | 14.687 ns | 0.3137 ns | 0.3356 ns | - | - |
| DivideToString_BigReal | 1,165.798 ns | 3.4006 ns | 3.1809 ns | 0.0534 | 344 B |
| DivideToString_BigDecimal | 2,822.685 ns | 24.7819 ns | 19.3481 ns | 0.5226 | 3296 B |
| DivideToString_BigFloat | 1,385.152 ns | 19.1418 ns | 16.9687 ns | 0.1869 | 1176 B |
| Parse_BigReal | 272.192 ns | 1.9640 ns | 1.6400 ns | 0.0062 | 40 B |
| Parse_BigDecimal | 243.745 ns | 1.3348 ns | 1.0421 ns | 0.0291 | 184 B |
| Parse_BigFloat | 311.843 ns | 5.5915 ns | 4.9568 ns | 0.0062 | 40 B |
| FromFloat_BigReal | 110.971 ns | 0.3906 ns | 0.3262 ns | - | - |
| FromFloat_BigDecimal | 322.433 ns | 0.9244 ns | 0.7719 ns | 0.0329 | 208 B |
| FromFloat_BigFloat | 1,609.420 ns | 5.7215 ns | 4.7777 ns | 0.1068 | 672 B |
Notes:
- Whereas
BigDecimaldivides by calculating the decimal digits at a certain precision,BigRealstores a fraction so the digits are only calculated atToString.
Background
BigReal is made by Joyless and based on BigFloat by FaustVX.
Some inspiration was taken from BigDecimal by AdamWhiteHat.
Gotchas
- The
defaultvalue ofBigRealis NaN, since 0 / 0 is NaN. - Dividing by 0 gives positive or negative infinity depending on the numerator.
| Product | Versions 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- LinkDotNet.StringBuilder (>= 3.2.0)
-
net9.0
- LinkDotNet.StringBuilder (>= 3.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on BigReal:
| Package | Downloads |
|---|---|
|
JsonhCs
JSON for Humans. |
|
|
BigDateTime
An arbitrary size and precision date and time stored using a BigReal. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.3.0 | 71 | 11/2/2025 |
| 5.2.0 | 63 | 11/2/2025 |
| 5.1.0 | 352 | 8/14/2025 |
| 5.0.0 | 149 | 8/14/2025 |
| 4.3.0 | 368 | 7/21/2025 |
| 4.2.0 | 236 | 6/26/2025 |
| 4.1.0 | 909 | 3/25/2025 |
| 4.0.0 | 245 | 3/12/2025 |
| 3.0.0 | 218 | 3/12/2025 |
| 2.0.0 | 239 | 3/10/2025 |
| 1.4.0 | 179 | 3/2/2025 |
| 1.3.0 | 185 | 3/1/2025 |
| 1.2.0 | 144 | 3/1/2025 |
| 1.1.0 | 138 | 3/1/2025 |
| 1.0.0 | 145 | 3/1/2025 |