approx#

approx(val1=None, val2=None, eps=None, **kwargs)[source]#

Determine whether two scalars (or an array and a scalar) approximately match. Alias for np.isclose() and may be removed in future versions.

Parameters:
  • val1 (number or array) – the first value

  • val2 (number) – the second value

  • eps (float) – absolute tolerance

  • kwargs (dict) – passed to np.isclose()

Examples:

sc.approx(2*6, 11.9999999, eps=1e-6) # Returns True
sc.approx([3,12,11.9], 12) # Returns array([False, True, False], dtype=bool)