Skip to content

test_complex.test_truediv can fail #144173

@encukou

Description

@encukou

Bug report

Bug description:

test_truediv has the following check:

        # Just for fun.
        for i in range(100):
            self.check_div(complex(random(), random()),
                           complex(random(), random()))

where check_div(x, y) checks that (x * y) / y is "close" to x.

This recently failed on AMD64 Arch Linux Usan Function with:

./python -m test test_complex -m test_truediv --randseed 1627284292

It fails with 1e-09 for the first random number and 1 for the rest.

Looks like a test bug but it might be better if a float/complex expert takes a look around here. @skirpichev, is this interesting for you?

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions