spacepy.toolbox.feq¶
-
spacepy.toolbox.
feq
(x, y, precision=5e-07)[source]¶ compare two floating point values if they are equal after: http://www.lahey.com/float.htm
Deprecated since version 0.2.2: use
numpy.isclose()
; thertol
keyword is equivalent toprecision
.- Parameters
- xfloat
a number
- yfloat or array of floats
other numbers to compare
- precisionfloat (optional)
Relative precision for equal (default 0.0000005) Specified as a fraction of the sum of
x
andy
.
- Returns
- outbool
True (equal) or False (not equal)
See also
Examples
>>> import spacepy.toolbox as tb >>> x = 1 + 1e-4 >>> y = 1 + 2e-4 >>> tb.feq(x, y) False >>> tb.feq(x, y, 1e-3) True