Skip to content

Commit

Permalink
simplify changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Jul 30, 2024
1 parent 9c954ce commit e76452e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
12 changes: 0 additions & 12 deletions base/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,18 +403,6 @@ function *(y::Integer, x::Rational)
end
/(x::Rational, y::Union{Rational, Integer}) = x//y
/(x::Integer, y::Rational) = x//y
# Avoid overflow for Rational math if result is zero.
# This method is needed because previously this method didn't check for overflows
# but would return the correct answer if `a` was zero even if 1//z was wrong.
function /(a::Rational, z::Complex{<:Integer})
z_r = complex(Rational(real(z)), Rational(imag(z)))
if iszero(a) && !iszero(z)
a/oneunit(z_r)
else
a/z_r
end
end

inv(x::Rational) = checked_den(x.den, x.num)

fma(x::Rational, y::Rational, z::Rational) = x*y+z
Expand Down
1 change: 0 additions & 1 deletion test/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ end
end

@test Rational(rand_int, 3)/Complex(3, 2) == Complex(Rational(rand_int, 13), -Rational(rand_int*2, 39))
@test iszero(zero(Rational{Int8}) / complex(Int8(100), Int8(100)))
@test (true//true) / complex(false, true) === 0//1 - 1//1*im
@test (false//true) / complex(false, true) === 0//1 + 0//1*im
@test (false//true) / complex(true, false) === 0//1 + 0//1*im
Expand Down

0 comments on commit e76452e

Please sign in to comment.