]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145767)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Mar 2026 17:05:07 +0000 (18:05 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Mar 2026 17:05:07 +0000 (17:05 +0000)
commitf349433df04090cd6c6a4934c0e5914b63afef2e
tree5a321d381ddfec39bb2366cb9c0ea3c6b60c3b4b
parentb5082d89cc90986776323fcaaf89e14a96e8e04b
[3.13] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145767)

gh-144173: fix flaky test_complex.test_truediv() (GH-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
```
(cherry picked from commit c4333a12708a917d1cfb6418c04be45793ecc392)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Lib/test/test_complex.py