IMathTNumericClamp Method

Returns value clamped to the inclusive range of bound1 and bound2.

Definition

Namespace: Jodosoft.Numerics
Assembly: Jodosoft.Numerics (in Jodosoft.Numerics.dll) Version: 2.0
TNumeric Clamp(
	TNumeric value,
	TNumeric bound1,
	TNumeric bound2
)

Parameters

value  TNumeric
The value to be clamped.
bound1  TNumeric
The first bound of the result (may be the lower or upper bound).
bound2  TNumeric
The second bound of the result (may be the lower or upper bound).

Return Value

TNumeric

value if bound1valuebound2.

-or-

bound1 if value < bound1.

-or-

bound2 if bound2 < value.

Remarks

This method may return NaN or Infinity. If NaN or Infinity cannot be represented by TNumeric, then this method may throw an ArithmeticException.

See Also