@@ -142,19 +142,21 @@ Number-theoretic and representation functions
142
142
``False `` otherwise.
143
143
144
144
Whether or not two values are considered close is determined according to
145
- given absolute and relative tolerances.
145
+ given absolute and relative tolerances. If no errors occur, the result will
146
+ be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) ``.
146
147
147
148
*rel_tol * is the relative tolerance -- it is the maximum allowed difference
148
149
between *a * and *b *, relative to the larger absolute value of *a * or *b *.
149
150
For example, to set a tolerance of 5%, pass ``rel_tol=0.05 ``. The default
150
151
tolerance is ``1e-09 ``, which assures that the two values are the same
151
- within about 9 decimal digits. *rel_tol * must be greater than zero.
152
-
153
- *abs_tol * is the minimum absolute tolerance -- useful for comparisons near
154
- zero. *abs_tol * must be at least zero.
155
-
156
- If no errors occur, the result will be:
157
- ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) ``.
152
+ within about 9 decimal digits. *rel_tol * must be nonnegative and less
153
+ than ``1.0 ``.
154
+
155
+ *abs_tol * is the absolute tolerance; it defaults to ``0.0 `` and it must be
156
+ nonnegative. When comparing ``x `` to ``0.0 ``, ``isclose(x, 0) `` is computed
157
+ as ``abs(x) <= rel_tol * abs(x) ``, which is ``False `` for any ``x `` and
158
+ rel_tol less than ``1.0 ``. So add an appropriate positive abs_tol argument
159
+ to the call.
158
160
159
161
The IEEE 754 special values of ``NaN ``, ``inf ``, and ``-inf `` will be
160
162
handled according to IEEE rules. Specifically, ``NaN `` is not considered
0 commit comments