| |
- has_close(data, value, rtol=1.0000000000000001e-05, atol=1e-08)
- Test if data has any values "equal" to value.
Returns 1 if any of the elements of argument data has a value
"equal" to argument value; returns 0 otherwise. If data or value
is floating point, "equal" means where abs(data-value) <= atol +
rtol * abs(value). This is essentially the same algorithm used
in the Numeric function allclose. If data and value are integer,
"equal" means strict equality.
Positional Input Arguments:
* data: Data. Scalar or Numeric array, Python list/tuple of
any size and shape. Floating or integer type.
* value: Test value. Scalar or 1 element Numeric array, list,
or tuple. Floating or integer type.
Keyword Input Arguments:
* rtol: "Relative" tolerance. Default is 1.e-5. Used in the
comparison between data and value only if the two are
floating point. Floating or integer type.
* atol: "Absolute" tolerance. Default is 1.e-8. Used in the
comparison between data and value only if the two are
floating point. Floating or integer type.
Examples:
>>> from has_close import has_close
>>> data = [20., -32., -1., 2., 5., 29.]
>>> has_close(data, -1.)
1
>>> has_close(data, 10.)
0
|