]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144173: fix flaky test_complex.test_truediv() (#144355)
authorSergey B Kirpichev <skirpichev@gmail.com>
Tue, 10 Mar 2026 16:40:51 +0000 (19:40 +0300)
committerGitHub <noreply@github.com>
Tue, 10 Mar 2026 16:40:51 +0000 (17:40 +0100)
commitc4333a12708a917d1cfb6418c04be45793ecc392
tree27202db3ca633167b3d6a7656e29520651dd999e
parent50f82d062b3b59a09d6b63648df22d46f7f2b010
gh-144173: fix flaky test_complex.test_truediv() (#144355)

Previously, component-wise relative error bound was tested.  However,
such bound can't exist already for complex multiplication as one can be
used to perform subtraction of floating-point numbers, e.g. x and y for
z0=1+1j and z1=x+yj.

```pycon
>>> x, y = 1e-9+1j, 1+1j
>>> a = x*y*y.conjugate()/2;a
(1.0000000272292198e-09+1j)
>>> b = x*(y*y.conjugate()/2);b
(1e-09+1j)
>>> b == x
True
>>> (a.real-b.real)/math.ulp(b.real)
131672427.0
```
Lib/test/test_complex.py