BigReal 5.7.0
dotnet add package BigReal --version 5.7.0
NuGet\Install-Package BigReal -Version 5.7.0
<PackageReference Include="BigReal" Version="5.7.0" />
<PackageVersion Include="BigReal" Version="5.7.0" />
<PackageReference Include="BigReal" />
paket add BigReal --version 5.7.0
#r "nuget: BigReal, 5.7.0"
#:package BigReal@5.7.0
#addin nuget:?package=BigReal&version=5.7.0
#tool nuget:?package=BigReal&version=5.7.0
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 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. |
-
net10.0
- LinkDotNet.StringBuilder (>= 3.4.1)
-
net8.0
- LinkDotNet.StringBuilder (>= 3.4.1)
-
net9.0
- LinkDotNet.StringBuilder (>= 3.4.1)
NuGet packages (3)
Showing the top 3 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. |
|
|
AstraLingua
A universal alien language invented for Konekomi Castle. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.7.0 | 309 | 2/19/2026 |
| 5.6.0 | 456 | 12/20/2025 |
| 5.5.0 | 576 | 11/12/2025 |
| 5.4.0 | 319 | 11/12/2025 |
| 5.3.0 | 255 | 11/2/2025 |
| 5.2.0 | 256 | 11/2/2025 |
| 5.1.0 | 396 | 8/14/2025 |
| 5.0.0 | 192 | 8/14/2025 |
| 4.3.0 | 399 | 7/21/2025 |
| 4.2.0 | 281 | 6/26/2025 |
| 4.1.0 | 944 | 3/25/2025 |
| 4.0.0 | 289 | 3/12/2025 |
| 3.0.0 | 258 | 3/12/2025 |
| 2.0.0 | 286 | 3/10/2025 |
| 1.4.0 | 215 | 3/2/2025 |
| 1.3.0 | 226 | 3/1/2025 |
| 1.2.0 | 183 | 3/1/2025 |
| 1.1.0 | 179 | 3/1/2025 |
| 1.0.0 | 190 | 3/1/2025 |