Skip to main content
Rationals package icon

Rationals

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

Total Downloads
1.2M
1,160,966
Published
Sep 15, 2018
Latest stable version

Install

.NET CLI
dotnet add package Rationals --version 1.3.2
Package Manager Console
Install-Package Rationals -Version 1.3.2
PackageReference
<PackageReference Include="Rationals" Version="1.3.2" />

Frameworks

.NETFramework4.6 .NETFramework4.7 .NETStandard1.4 .NETStandard2.0

Dependencies

NETStandard.Library
.NETStandard1.4
[1.6.1, )

Adoption guide

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.

Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.

How to read this guidance

Sources: published NuGet v3 registry metadata and explicit NuBrowse editorial guides. Refresh: package metadata is refreshed from NuGet when the page loads. Limit: this is not a security, legal or compatibility guarantee; validate the selected version in your project.

Useful next steps

Move from package metadata to a concrete selection or review workflow.