Tolerance.is_between

Tolerance.is_between(value, minval, maxval, atol=None)[source]

Check if a value is between two other values.

Parameters:
valuefloat

The value.

minvalfloat

The minimum value.

maxvalfloat

The maximum value.

atolfloat, optional

The absolute tolerance. Default is None, in which case self.absolute is used.

Returns:
bool

True if the value is between the two other values. False otherwise.

Examples

>>> tol = Tolerance()
>>> tol.is_between(0.5, 0.0, 1.0)
True
>>> tol.is_between(1.5, 0.0, 1.0)
False