Accord.NET Framework

## RationalEpsilon Field |

Represents the minimum positive value of a Rational.

Syntax

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