|
|
|
|
|
by lukax
56 days ago
|
|
You generally want both relative and absolute tolerances. Relative handles scale, absolute handles values near zero (raw EPSILON isn’t a universal threshold per IEEE 754). The usual pattern is abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) to avoid both large-value and near-zero pitfalls. |
|
https://github.com/python/cpython/blob/d61fcf834d197f0113a6a...