-
-
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
Math operations with Int
does not warn overflow
#44565
Comments
Int
does not warning overflowInt
does not warn overflow
dup of #22539 |
Yeah, sure, I saw that Issue. But this shouldn't be warned? |
I could think of a way to warn that. |
The problem isn't warning, the problem is that warning without tanking performance. This is probably achievable for exponentiation, but definitely isn't for addition/multiplication. |
I understand that, but could you please appoint me where the code could be changed to implement it? I want to make some tests and benchmarks. |
I also think this is not a duplication of that issue. |
Base/int.jl:87 for addition, and 88 for multiplication. Good luck. |
A warning is a problem. It should either error or do nothing, but not warn. |
I don't know. |
@oscardssmith Could you re-open this issue? |
OK. That said, be warned that erroring (or warning) is a breaking change that can't happen until 2.0, and is unlikely to be merged unless the error has no runtime cost (which it will). |
There is nothing really to discuss here. You can take a look at #21600 for erroring for pow. |
But this shouldn't be an open issue to PRs references it? |
The reason this issue was (originally) closed so quickly is because there already has been a tremendous amount of discussion about this, e.g. on discourse. Julia just isn't at that stage of development anymore, where such things are considered. |
Okay, but this is a problem and should be documented somewhere. |
This is already prominently answered/documented, in the FAQ of the documentation. |
Ok, thanks! I'm closing this issue since this discussion was already done and is documented in the Integers Documentation and in the FAQ of the documentation. |
Hi, I guess that could be a bug, but overflows shouldn't be warned?
julia> typemax(Int) + 1 -9223372036854775808
julia> typemax(Int)^2 -1
Compilation: Generic Linux on x86 64-bit
Version: Julia v1.6.5 (LTS)
The text was updated successfully, but these errors were encountered: