Open
Description
Describe the bug
Attempts to format the number 1-1j
will result in a ValueError raised. This is due to a feature (bug?) in CPython:
x = 1+-1j # this does not raise an error
x = complex("1+-1j") # this raises a ValueError
Unfortunately this case must be hit quite frequently in these lines of code:
Lines 431 to 446 in ecc823a
To Reproduce
from deepdiff.helper import number_to_string
print(number_to_string(1-1j, significant_digits=1)) # raises a ValueError
Expected behavior
I expect this to print 1.0-1.0j
, not raise an error!
I am using
- Python 3.12
- DeepDiff on main
Metadata
Metadata
Assignees
Labels
No labels