Revision d24316ac6465302aa32d9616ab731499c3734bce authored by Nathan Zimmerberg on 07 February 2024, 15:53:14 UTC, committed by GitHub on 07 February 2024, 15:53:14 UTC
Fixes #51731 and #51730 Also fixes one of the previously broken tests: ```julia @test_broken Rational{Int64}(UInt(1), typemin(Int32)) == Int64(1) // Int64(typemin(Int32)) ``` This PR ensures the `Rational{T}` constructor with concrete `T` will only throw if the final numerator and denominator cannot be represented by `T`, or are both zero. If the `T` in `Rational{T}` is not concrete, this PR tries to ensure the numerator and denominator are promoted to the same type. This means `-1*Rational{Integer}(-1, 0x01) == 1` doesn't throw now. A side effect of this is that `Rational{Integer}(Int8(-1), 0x01)` now throws. Also, related to <https://github.com/JuliaLang/julia/pull/25702#issuecomment-359821951>, now `divgcd` doesn't change the types of its inputs and can handle `typemin`, but it still throws a `DivideError` if both inputs are zero.
1 parent 736eeda
typos.toml
[default]
extend-ignore-words-re = ["^[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?$"]
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...