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

typemin divided by negative 1 is an error #49419

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

oscardssmith
Copy link
Member

fixes #49398

@oscardssmith oscardssmith added the test This change adds or pertains to unit tests label Apr 19, 2023
@oscardssmith
Copy link
Member Author

failing tests were added by #47995

@Seelengrab
Copy link
Contributor

Which of these is the unintended behavior?

julia> div(typemin(Int8), Int8(-1))
ERROR: DivideError: integer division error
Stacktrace:
 [1] div(x::Int8, y::Int8)
   @ Base ./int.jl:295
 [2] top-level scope
   @ REPL[2]:1

julia> div(typemin(Int8), Base.MultiplicativeInverses.multiplicativeinverse(typemin(Int8)))
1

@oscardssmith
Copy link
Member Author

oscardssmith commented Apr 19, 2023

did you mean

julia> div(typemin(Int8), Base.multiplicativeinverse(Int8(-1)))
-128

@Seelengrab
Copy link
Contributor

Ah, yes! My question is whether div on a multiplicativeinverse there should error as well, or whether that explicitly should not error.

@staticfloat staticfloat merged commit 68ed6f7 into JuliaLang:master Apr 27, 2023
@oscardssmith oscardssmith deleted the fix-multiinv-test branch April 27, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integer division error in tests
3 participants