# Fractional.NET 1.0.0

Install-Package Fractional.NET -Version 1.0.0
dotnet add package Fractional.NET --version 1.0.0
<PackageReference Include="Fractional.NET" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
#r "nuget: Fractional.NET, 1.0.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 Fractional.NET as a Cake Addin

// Install Fractional.NET as a Cake Tool
#tool nuget:?package=Fractional.NET&version=1.0.0

### Conversion

Basic conversion operations

#### Conversion to human readable fraction

Conversion of decimals with approximate guessing :

var f1 = new Fractional(0.333333d, keepExcat: false);
var f2 = new Fractional(0.75d, keepExcat: false);

Console.WriteLine(f1.HumanRepresentation); // Output: 1/3
Console.WriteLine(f2.HumanRepresentation); // Output: 3/4

Conversion of decimals without approximate guessing :

var f1 = new Fractional(0.333333d, keepExcat: true);
var f2 = new Fractional(0.75d, keepExcat: true);

Console.WriteLine(f1); // Output: 333333/1000000
Console.WriteLine(f2); // Output: 75/100

#### Conversion to decimal

Conversion to human fractions to decimals

var f1 = new Fractional("7 3/4");
var f2 = new Fractional("3/4");

Console.WriteLine(f1.Value); // Output: 7.75
Console.WriteLine(f2.Value); // Output: 0.75

#### Arithmetic operations and Comparisons

The fraction instance work very well with math operators even with other numerics and string representations :

var f1 = new Fractional("3/4");
var f2 = new Fractional("1/2");

Console.WriteLine(f1 + 0.5d);    // Output: 1 1/4
Console.WriteLine(f1 + f2);      // Output: 1 1/4
Console.WriteLine(f1 - 1.75d);   // Output: -1
Console.WriteLine(f1 - f2);      // Output: 1/4

It does the same work with Comparisons operators

var f1 = new Fractional("5 3/2");
var f2 = new Fractional("3 3/2");

Console.WriteLine(f1 > f2);        // Output: true
Console.WriteLine(f1 < 7.0d);      // Output: true
Console.WriteLine(f2 > 5.0d);      // Output: false
• #### .NETStandard 2.0

• No dependencies.

### NuGet packages

This package is not used by any NuGet packages.

### GitHub repositories

This package is not used by any popular GitHub repositories.