Skip to content

Commit

Permalink
Merge pull request #21203 from giordano/iszero-irrational
Browse files Browse the repository at this point in the history
Add iszero method with Irrational argument
  • Loading branch information
JeffBezanson committed Apr 27, 2017
2 parents 711291a + defab5a commit 19e3f1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/irrationals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ end
<=(x::Rational, y::Irrational) = x < y

isfinite(::Irrational) = true
iszero(::Irrational) = false

hash(x::Irrational, h::UInt) = 3*object_id(x) - h

Expand Down
3 changes: 3 additions & 0 deletions test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,9 @@ end
end
end
@test !iszero(nextfloat(BigFloat(0)))
for x in (π, e, γ, catalan, φ)
@test !iszero(x)
end

# Array reduction
@test !iszero([0, 1, 2, 3])
Expand Down

0 comments on commit 19e3f1b

Please sign in to comment.