Click or drag to resize
Accord.NET (logo)

RationalEpsilon Field

Represents the minimum positive value of a Rational.

Namespace:  Accord.Math
Assembly:  Accord (in Accord.dll) Version: 3.8.0
Syntax
public static readonly Rational Epsilon
Request Example View Source

Field Value

Type: Rational
Remarks

This field has a value of 1 / 2,147,483,647.

This does NOT represent the minimum possible difference between two Rational instances; some rationals may have a smaller difference. If you try to subrtact two rationals whose difference is smaller than this value, you will get unexpected results due to overflow.

Examples
To check for this case, you can add this value to one of the rationals and compare to the other rational.
if (r1 + Rational.Epsilon > r2 && r1 - Rational.Epsilon < r2)
{
  // Difference between r1 and r2 is less than Rational.Epsilon.
}
See Also