Info
Version: | 1.0.0.13 |
Author(s): | Ryan S. Thiele |
Last Update: | Wednesday, December 2, 2020 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/Dynamensions.Conversion.DecimalsAndFractions |
Install
Install-Package Dynamensions.Conversion.DecimalsAndFractions
dotnet add package Dynamensions.Conversion.DecimalsAndFractions
paket add Dynamensions.Conversion.DecimalsAndFractions
Dynamensions.Conversion.DecimalsAndFractions Download (Unzip the "nupkg" after downloading)
---
When converting to fractions:
- MyDecimal.ToFraction(<common denominator>)
- E.g. common denominator = 4 means it will round it to the nearest 1/4).
- 0 will not round (may get a strange fraction like 13/125).
---
When converting to decimals
- MyFraction.ToDecimal();
- No rounding is done but can be followed by RoundByFraction()
---
Round By Fraction
- MyDecimal.RoundByFraction(denominator)
- e.g.
4 will round the deicmal to the nearest 1/4.
- MyDecimal.RoundByFraction(commonFraction)
- Common fractions are 1/16, 1/8, 1/4, 1/2.