julia
fb01dd28 - Throw OverflowError on typemin(Int)//(-1) (#51085)

Commit
2 years ago
Throw OverflowError on typemin(Int)//(-1) (#51085) Fixes #32443 Currently `typemin(Int)//(-1) == typemin(Int)//(1)`, ignoring an overflow. As noted by @JeffreySarnoff in [#32443](https://github.com/JuliaLang/julia/issues/32443#issuecomment-506816722) This should throw an error instead of silently overflowing. To fix this I am using `checked_neg` instead of `-` in the Rational constructor. With this PR `(-one(T))//typemin(T)` will now also throw an `OverflowError` instead of an `ArgumentError`
Author
Parents
Loading