Home
last modified time | relevance | path

Searched refs:rel_tol (Results 1 – 9 of 9) sorted by relevance

/third_party/python/Modules/clinic/
Dmathmodule.c.h574 math_isclose_impl(PyObject *module, double a, double b, double rel_tol,
587 double rel_tol = 1e-09; in math_isclose() local
620 rel_tol = PyFloat_AS_DOUBLE(args[2]); in math_isclose()
624 rel_tol = PyFloat_AsDouble(args[2]); in math_isclose()
625 if (rel_tol == -1.0 && PyErr_Occurred()) { in math_isclose()
644 _return_value = math_isclose_impl(module, a, b, rel_tol, abs_tol); in math_isclose()
Dcmathmodule.c.h890 double rel_tol, double abs_tol);
902 double rel_tol = 1e-09; in cmath_isclose() local
923 rel_tol = PyFloat_AS_DOUBLE(args[2]); in cmath_isclose()
927 rel_tol = PyFloat_AsDouble(args[2]); in cmath_isclose()
928 if (rel_tol == -1.0 && PyErr_Occurred()) { in cmath_isclose()
947 _return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol); in cmath_isclose()
/third_party/python/Doc/library/
Dcmath.rst211 .. function:: isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
219 *rel_tol* is the relative tolerance -- it is the maximum allowed difference
221 For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default
223 within about 9 decimal digits. *rel_tol* must be greater than zero.
229 ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
Dmath.rst144 .. function:: isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
152 *rel_tol* is the relative tolerance -- it is the maximum allowed difference
154 For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default
156 within about 9 decimal digits. *rel_tol* must be greater than zero.
162 ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``.
/third_party/python/Lib/test/
Dtest_math.py2113 self.assertIsClose(1, 1, rel_tol=-1e-100)
2115 self.assertIsClose(1, 1, rel_tol=1e-100, abs_tol=-1e10)
2125 self.assertAllClose(identical_examples, rel_tol=0.0, abs_tol=0.0)
2132 self.assertAllClose(eight_decimal_places_examples, rel_tol=1e-8)
2133 self.assertAllNotClose(eight_decimal_places_examples, rel_tol=1e-9)
2141 self.assertAllNotClose(near_zero_examples, rel_tol=0.9)
2172 self.assertAllClose(zero_tolerance_close_examples, rel_tol=0.0)
2177 self.assertAllNotClose(zero_tolerance_not_close_examples, rel_tol=0.0)
2181 self.assertAllClose([(9, 10), (10, 9)], rel_tol=0.1)
2188 self.assertAllClose(integer_examples, rel_tol=1e-8)
[all …]
Dtest_cmath.py603 self.isclose(1j, 1j, rel_tol=1j)
609 self.isclose(1j, 1j, rel_tol=1j, abs_tol=1j)
619 self.assertAllClose(complex_examples, rel_tol=1e-12)
620 self.assertAllNotClose(complex_examples, rel_tol=1e-13)
/third_party/python/Modules/
Dcmathmodule.c1184 double rel_tol, double abs_tol) in cmath_isclose_impl() argument
1190 if (rel_tol < 0.0 || abs_tol < 0.0 ) { in cmath_isclose_impl()
1221 return (((diff <= rel_tol * _Py_c_abs(b)) || in cmath_isclose_impl()
1222 (diff <= rel_tol * _Py_c_abs(a))) || in cmath_isclose_impl()
Dmathmodule.c2966 math_isclose_impl(PyObject *module, double a, double b, double rel_tol, in math_isclose_impl() argument
2973 if (rel_tol < 0.0 || abs_tol < 0.0 ) { in math_isclose_impl()
3003 return (((diff <= fabs(rel_tol * b)) || in math_isclose_impl()
3004 (diff <= fabs(rel_tol * a))) || in math_isclose_impl()
/third_party/python/Doc/whatsnew/
D3.5.rst620 >>> math.isclose(a, b, rel_tol=1e-5)
622 >>> math.isclose(a, b, rel_tol=1e-6)