Math<T>.Clamp Method
Returns a number constrained to be within the specified interval.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
C#
value constrained to the specified interval.
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
public static T Clamp(
T value,
T lowerBound,
T upperBound
)Parameters
- value T
- The value to constrain.
- lowerBound T
- The lower bound of the interval.
- upperBound T
- The upper bound of the interval.
Return Value
Tvalue constrained to the specified interval.
Remarks
For floating-point values, a NaN value or NaN bound returns NaN.
Exceptions
| Argument | upperBound is less than lowerBound. |