-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
sign(pi)
errors
#37931
Comments
What type should it return? Float64? |
that's the real question. I would say or |
Can you fix this with:
I tried to fix for all (only two?) such constants, and all future ones:
without the Revise command it ran, while ineffective, since Real is checked first? It there no way for it to be checked later? |
@PallHaraldsson you mean:
There are a few of them. yeah, that could work actually, since there's no way to represent a negative |
Since @Moelf |
@simeonschaub I see. that's true, but in terms of Julia's representation, we can't really represent a negative irrational number. |
I am not sure I follow. For example, you can do the following:
|
I'm saying that:
the sign is encoded in |
As a user, I would expect that the following test is satisfied for any type (except for unsigned ones, obviously). @test sign(pi) === -sign(-pi) (Otherwise, I may cause unexpected type instability.) |
Is this also bad? I'm just not sure:
|
more reason to make everything about irrational just
|
This is also counterintuitive. julia> pi == one(pi) * pi
false
julia> zero(pi) == one(pi) * pi - pi
true |
The former is probably by design. Note:
|
I have found in docs of Return a multiplicative identity for `x`: a value such that
`one(x)*x == x*one(x) == x`. So I have opened a separate issue for that. |
The only solutions to most of these complaints are to delete the |
So what you're saying is that the only 1.0 compatible fix is adding a basic CAS? Should good to me :) |
Didn't find an existing issue
https://discourse.julialang.org/t/problem-with-sign-pi/47801/
The text was updated successfully, but these errors were encountered: