Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upmod(::Complex{<:Integer}, ::Integer) and div etc. #37376
Comments
|
I disagree, I think it should be mod(z::Complex, n) = Complex(mod(real(z), n), mod(imag(z), n))Since this defines |
|
Yes, that's a reasonable further generalization, although I would be more conservative and restrict it to mod(z::Complex, n::Real) = ...If |
|
Edit: sorry I was mistaken in my last post. I don't quite see the argument for restricting the dispatch though, if it errors, then it errors, why restrict the dispatch? And why is |
|
The problem with dispatching to something that is unlikely to ever be implemented is that the error message is needlessly confusing, both to users and to future implementors — if we want to support As for generalizing the |
|
Also, if |
As discussed on discourse, this seems like the only sensible definition:
and similarly for
div,rem(and probablydivrem).Should be easy to create a patch (much simpler than #35374): just add the 1-line definitions analogous to the one above, docs, news, and a test.