]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145766)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Mar 2026 17:08:00 +0000 (18:08 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Mar 2026 17:08:00 +0000 (17:08 +0000)
commit0af35f5a8522197c2ee18260270ad6ecb4bde467
tree7800d742b0fb1dc5b775e718876816b03fd2c1e6
parent7e389260aa3a1b56c1b986c1ed9ef180d645ede0
[3.14] gh-144173: fix flaky test_complex.test_truediv() (GH-144355) (#145766)

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