Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surprising comparisons with complex numbers #1072

Open
fredrik-johansson opened this issue May 21, 2021 · 4 comments
Open

Surprising comparisons with complex numbers #1072

fredrik-johansson opened this issue May 21, 2021 · 4 comments

Comments

@fredrik-johansson
Copy link
Contributor

julia> AcbField(64)(1) == 1+0im
false

julia> fmpq(1) == 1+0im
false
@wbhart
Copy link
Contributor

wbhart commented May 21, 2021

Probably more off by 0.7 bugs.

@fredrik-johansson
Copy link
Contributor Author

Note that

julia> QQ(1) == 1+0im
true

works in AbstractAlgebra, so this appears to be a Nemo-exclusive feature.

@wbhart
Copy link
Contributor

wbhart commented Jun 10, 2021

The reason this happens is that complex numbers are just not supported outside Arb in Nemo or AbstractAlgebra.

It just happens to work in AbstractAlgebra because QQ(1) returns a Julia Rational{BigInt} and Julia has defined an appropriate comparison.

In Nemo, the equality test falls back to the default Julia one which just tests if they are the same object.

This is a rather massive thing to fix as it means defining ad hoc comparison, binary operations and divisions for every type in AbstractAlgebra and Nemo with complex numbers.

You can tell we aren't numerical people can't you. :-)

@fredrik-johansson
Copy link
Contributor Author

It also needs to be fixed for qqbar and ca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants