Compare.Sequence Almost Equal Ulps Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.6
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.6
Overload List
Sequence | Returns whether the values in the specified array are all close to the reference value within the given tolerance expressed in ULPs (units in the last place). |
Sequence | Returns whether the specified values in the arrays are close to each other within the given tolerance expressed in ULPs (units in the last place). |
Sequence | Returns whether the values in the specified sequence are all close to the reference value within the given tolerance expressed in ULPs (units in the last place). |
Sequence | Returns whether the specified values in the sequences are close to each other within the given tolerance expressed in ULPs (units in the last place). |
Sequence | Returns whether the values in the specified span are all close to the reference value within the given tolerance expressed in ULPs (units in the last place). |
Sequence | Returns whether the specified values in the spans are close to each other within the given tolerance expressed in ULPs (units in the last place). |
SequenceAlmostEqualUlps<T>(T[], T, T, Boolean, Boolean, Boolean)
Returns whether the values in the specified array are all close to the reference value
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this T[] values,
T referenceValue,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values T[]
- The array of values to compare.
- referenceValue 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), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).SequenceAlmostEqualUlps<T>(T[], T[], T, Boolean, Boolean, Boolean)
Returns whether the specified values in the arrays are close to each other
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this T[] values,
T[] referenceValues,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values T[]
- The array of values to compare.
- referenceValues T[]
- The array of reference values 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), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).SequenceAlmostEqualUlps<T>(IEnumerable<T>, T, T, Boolean, Boolean, Boolean)
Returns whether the values in the specified sequence are all close to the reference value
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this IEnumerable<T> values,
T referenceValue,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values IEnumerable<T>
- The sequence of values to compare.
- referenceValue 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), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).SequenceAlmostEqualUlps<T>(IEnumerable<T>, IEnumerable<T>, T, Boolean, Boolean, Boolean)
Returns whether the specified values in the sequences are close to each other
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this IEnumerable<T> values,
IEnumerable<T> referenceValues,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values IEnumerable<T>
- The sequence of values to compare.
- referenceValues IEnumerable<T>
- The sequence of reference values 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), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).SequenceAlmostEqualUlps<T>(ReadOnlySpan<T>, T, T, Boolean, Boolean, Boolean)
Returns whether the values in the specified span are all close to the reference value
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this ReadOnlySpan<T> values,
T referenceValue,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values ReadOnlySpan<T>
- The span of values to compare.
- referenceValue 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), referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).SequenceAlmostEqualUlps<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, T, Boolean, Boolean, Boolean)
Returns whether the specified values in the spans are close to each other
within the given tolerance expressed in ULPs (units in the last place).
public static bool SequenceAlmostEqualUlps<T>(
this ReadOnlySpan<T> values,
ReadOnlySpan<T> referenceValues,
T ulps,
bool equalNaN = false,
bool equalInfinity = true,
bool symmetric = false
)
where T : Object, IComparable<T>
Parameters
- values ReadOnlySpan<T>
- The span of values to compare.
- referenceValues ReadOnlySpan<T>
- The span of reference values 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), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.
Type Parameters
- T
- The type of the values to compare.
Return Value
Booleantrue if all values are close; otherwise, false.