AngouriMath

Navigation

← Back to list of members

FloatToRationalIterCount

 Property

Summary

Amount of iterations allowed for attempting to cast to a rational
The more iterations, the larger fraction could be calculated

Example

using System;
using AngouriMath;
using static AngouriMath.MathS;

void Method()
{
    Console.WriteLine("---------------------");
    Entity a = 5.5m;
    Console.WriteLine(a);
    Entity b = 5.462m;
    Console.WriteLine(b);
    Entity c = 5.0m / 7.0m;
    Console.WriteLine(c);
}

Settings.FloatToRationalIterCount.As(1, Method);
Settings.FloatToRationalIterCount.As(3, Method);
Settings.FloatToRationalIterCount.As(5, Method);
Settings.FloatToRationalIterCount.As(10, Method);

Prints
5.5
5.462
0.7142857142857142857142857143
---------------------
11/2
5.462
0.7142857142857142857142857143
---------------------
11/2
5.462
5/7
---------------------
11/2
2731/500
5/7

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online