Skip to content

Commit

Permalink
julia/Float: x == 0 -> iszero(x) (#1870)
Browse files Browse the repository at this point in the history
Updates #1868
  • Loading branch information
nsajko authored Oct 20, 2024
1 parent cc5db52 commit f6868d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/julia/Float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ divexact(a::Rational{T}, b::AbstractFloat; check::Bool=true) where T <: Union{Si
divexact(a::Rational{BigInt}, b::BigFloat; check::Bool=true) = a/b

function divides(a::BigFloat, b::BigFloat)
if b == 0
if iszero(b)
return false, BigFloat(0)
else
return true, divexact(a, b; check=false)
Expand All @@ -109,7 +109,7 @@ end
###############################################################################

function gcd(a::T, b::T) where T <: AbstractFloat
if a == 0 && b == 0
if iszero(a) && iszero(b)
return T(0)
else
return T(1)
Expand All @@ -123,7 +123,7 @@ end
###############################################################################

function ppio(a::T, b::T) where T <: AbstractFloat
if a == 0 && b == 0
if iszero(a) && iszero(b)
return T(0), T(0)
else
return T(1), a
Expand Down

0 comments on commit f6868d0

Please sign in to comment.