Rationals 1.1.1

There is a newer version of this package available.
See the version list below for details.
Install-Package Rationals -Version 1.1.1
dotnet add package Rationals --version 1.1.1
<PackageReference Include="Rationals" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rationals --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rationals, 1.1.1"
#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.1.1

// Install Rationals as a Cake Tool
#tool nuget:?package=Rationals&version=1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Implementation of rational number arithmetics for .NET, written in C#

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 & 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

Example usage:

Rational left = (Rational) 1 / 2;

Rational right = (Rational) 1 / 4;

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

This package has no dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Rationals:

Package Downloads

Peachpie PHP language library functions.


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


.NET implementation of radical expressions enabling radical expression arithmetic.

GitHub repositories (1)

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

Repository Stars
PeachPie - the PHP compiler and runtime for .NET and .NET Core
Version Downloads Last updated
2.0.0 468 8/21/2021
1.4.1 416 7/6/2021
1.4.0 22,016 12/28/2020
1.3.3 58,833 1/15/2019
1.3.2 21,782 9/15/2018
1.3.1 30,196 11/18/2017
1.3.0 1,048 11/11/2017
1.2.1 1,184 3/11/2017
1.2.0 2,772 7/2/2016
1.1.1 912 7/2/2016
1.1.0 905 7/2/2016
1.0.0 1,455 11/1/2014