Compare.AlmostEqualsUlps<T> Method
Returns whether the specified value is close to the reference value
within the given tolerance expressed in ULPs (units in the last place).
DefinitionPermalink
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.7
C#
true if the values are close; otherwise, false.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.7
public static bool AlmostEqualsUlps<T>(
this T value1,
T value2,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
ParametersPermalink
- value1 T
- The value to compare.
- value2 T
- The reference value to compare against.
- ulps T
- Optional. The tolerance in ULPs (units in the last place).
- equalNaN Boolean (Optional)
- Optional. Specifies whether NaN values are considered equal. The default is false.
- equalInfinity Boolean (Optional)
- Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
- symmetric Boolean (Optional)
- Optional. If false (the default), value2 is used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type ParametersPermalink
- T
- The type of the values to compare.
Return ValuePermalink
Booleantrue if the values are close; otherwise, false.