Elementary.Threshold Method
Applies a threshold to the specified value, setting it to zero
if its absolute value is less than the given tolerance.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.1.4
C#
The original value of x if its absolute value is greater than or equal to tolerance; otherwise, 0.0.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.1.4
public static double Threshold(
double x,
double tolerance = 2.22044604925031E-16
)
Parameters
- x Double
- The value to evaluate against the threshold.
- tolerance Double (Optional)
- Optional. The tolerance value used to determine whether x should be set to zero. The default value is Epsilon.
Return Value
DoubleThe original value of x if its absolute value is greater than or equal to tolerance; otherwise, 0.0.
Remarks
This method is useful for eliminating small numerical values
that are effectively zero within a specified tolerance.