Skip to content

Commit

Permalink
Add iszero method with Irrational argument
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Mar 28, 2017
1 parent 4809620 commit defab5a
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 @@ -2949,6 +2949,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 defab5a

Please sign in to comment.