-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Complex.zero returns unexpeceted #sign #11700
Comments
Forgive me if I'm not fully understanding the problem, but what would we expect the correct output to be here? #sign is currently implemented using division, and division by 0 is resulting in NaN in this case. |
I think (0, 0) is expected to be returned. That said, |
According to the wikipedia
So I would classify this as an outright bug. @wontruefree out of curiosity, what brought you to this function? |
@beta-ziliani I have been looking for undocumented and under documented features and trying to understand them and add docs for them |
My physicist wife tells me this function is useful to have, so it's better to fix it and document it. |
Bug Report
Some Complex numbers that have zeros return
0
and0i
but on the defaultzero
case it returnsNaN
andNaNi
. This was unexpected to me. After bringing it up on Discord it seems like it might be a bug.Here is an example of an expected
0
sign. https://play.crystal-lang.org/#/r/cjvtoutput:
Here is the case I am not sure if it is correct. https://play.crystal-lang.org/#/r/cjvv
output
The text was updated successfully, but these errors were encountered: