Skip to content

Commit f6868d0

Browse files
authored
julia/Float: x == 0 -> iszero(x) (Nemocas#1870)
Updates Nemocas#1868
1 parent cc5db52 commit f6868d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/julia/Float.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ divexact(a::Rational{T}, b::AbstractFloat; check::Bool=true) where T <: Union{Si
9191
divexact(a::Rational{BigInt}, b::BigFloat; check::Bool=true) = a/b
9292

9393
function divides(a::BigFloat, b::BigFloat)
94-
if b == 0
94+
if iszero(b)
9595
return false, BigFloat(0)
9696
else
9797
return true, divexact(a, b; check=false)
@@ -109,7 +109,7 @@ end
109109
###############################################################################
110110

111111
function gcd(a::T, b::T) where T <: AbstractFloat
112-
if a == 0 && b == 0
112+
if iszero(a) && iszero(b)
113113
return T(0)
114114
else
115115
return T(1)
@@ -123,7 +123,7 @@ end
123123
###############################################################################
124124

125125
function ppio(a::T, b::T) where T <: AbstractFloat
126-
if a == 0 && b == 0
126+
if iszero(a) && iszero(b)
127127
return T(0), T(0)
128128
else
129129
return T(1), a

0 commit comments

Comments
 (0)