Skip to content

Treat minus as a number separator in FLOAT_CMP - #328

Closed
abhishekcpp007 wants to merge 2 commits into
scientific-python:mainfrom
abhishekcpp007:fix/float-cmp-negative-imag
Closed

abhishekcpp007 wants to merge 2 commits into
scientific-python:mainfrom
abhishekcpp007:fix/float-cmp-negative-imag

Conversation

@abhishekcpp007

Copy link
Copy Markdown

In front_sep = r'\s|[*+-,<=(\[]' the +-, is a character range from + to ,, so - isn't a separator. Numbers right after a - aren't found, and a complex repr with a negative imaginary part fails under FLOAT_CMP:

>>> complex(1.5, 2.50000001)  # doctest: +FLOAT_CMP
(1.5+2.5j)
>>> complex(1.5, -2.50000001)  # doctest: +FLOAT_CMP
(1.5-2.5j)

The first passes and the second fails with Got: (1.5-2.50000001j). Escaping the - fixes it. A flipped sign like (1.5+2.5j) vs (1.5-2.5j) still fails.

Added test_float_cmp_complex next to test_float_cmp_dict and a changelog entry.

@pllim

pllim commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@bsipocz do we have AI policy over here yet?

@bsipocz

bsipocz commented Nov 16, 2026

Copy link
Copy Markdown
Member

No formal policy, I would just close obnoxious or noone asked for busywork PRs, but this one feels OK.

@bsipocz bsipocz added the bug label Nov 16, 2026
@bsipocz bsipocz closed this Nov 16, 2026
@bsipocz bsipocz reopened this Nov 16, 2026
@bsipocz

bsipocz commented Nov 16, 2026

Copy link
Copy Markdown
Member

@pllim - That being said, I would just put these PRs into the parking lot and come back to them like once or week or something rather than dealing with at all when they first show up on my notification list -- so they won't force push themselves into a priority list.

@pllim

pllim commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

FWIW, here are some statistics on abhishekcpp007's activity on GitHub:

Last 24 hours Last 7 days
Pull requests opened 5 42
Issues opened 1 2

@abhishekcpp007 abhishekcpp007 closed this by deleting the head repository Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants