Rationals 1.4.0

.NET Standard 1.3 .NET Framework 4.0
This package has a SemVer 2.0.0 package version: 1.4.0+build.75.
There is a newer version of this package available.
See the version list below for details.
NuGet\Install-Package Rationals -Version 1.4.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.
dotnet add package Rationals --version 1.4.0
<PackageReference Include="Rationals" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rationals --version 1.4.0
#r "nuget: Rationals, 1.4.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rationals as a Cake Addin
#addin nuget:?package=Rationals&version=1.4.0

// Install Rationals as a Cake Tool
#tool nuget:?package=Rationals&version=1.4.0

Implementation of rational number arithmetic for .NET with arbitrary precision.

Supported features:

- implicit conversions - rationals integrate seamlessly with other number types
- unlimited precision - rationals use BigInteger inside
- canonical form - each rational can have its canonical form (irreducible fraction where denominator is always positive)
- separate whole and fractional part - any rational number can be separated into a whole part (integer quotient aka result of integer division) and fractional part (reminder of the integral division aka result of modulo operation)
- comparison &amp; equality
- multiple formatting options - ToString("C") (canonical form), ToString("W") (whole + fractional part), or normal fraction format
- continued fraction expansion - expand rational numbers to continued fraction (sequence of coefficients), construct rational numbers from sequence of continued fraction coefficients
- rational number approximation - approximate floating point numbers (decimal, double, float) as rational numbers with customizable tolerance

Example usage:

Rational left = (Rational) 1 / 2;

Rational right = (Rational) 1 / 4;

Rational sum = left + right; // equals to: 3 / 4

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Rationals:

Package Downloads
Peachpie.Library

Peachpie PHP language library functions.

CryptoExchangeClient

Clients for multiple cryptocurrency exchanges. All clients have a shared interface for common actions.

DelSquared.Radicals

.NET implementation of radical expressions enabling radical expression arithmetic.

DoodleDigits.Core

Math library powering Doodle Digits. Takes a string input and returns a number of results.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Rationals:

Repository Stars
peachpiecompiler/peachpie
PeachPie - the PHP compiler and runtime for .NET and .NET Core
Version Downloads Last updated
2.0.0 6,497 8/21/2021
1.4.1 1,491 7/6/2021
1.4.0 50,054 12/28/2020
1.3.3 171,431 1/15/2019
1.3.2 23,400 9/15/2018
1.3.1 33,486 11/18/2017
1.3.0 1,196 11/11/2017
1.2.1 1,321 3/11/2017
1.2.0 2,935 7/2/2016
1.1.1 1,060 7/2/2016
1.1.0 1,053 7/2/2016
1.0.0 1,598 11/1/2014