Skip to content

Commit

Permalink
Compare nan (#347)
Browse files Browse the repository at this point in the history
* close issue  #346

* version bump
  • Loading branch information
jverzani authored May 23, 2020
1 parent 6ddb9ba commit b6c85ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "SymPy"
uuid = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
version = "1.0.20"
version = "1.0.21"


[deps]
Expand Down
6 changes: 3 additions & 3 deletions src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ iterate(x::Sym) = (x.__pyobject__, 0)
iterate(x::Sym, state) = nothing


Base.isless(a::Sym, b::Sym) = sympy.Lt(a,b) == True
Base.isless(a::Sym, b::Number) = sympy.Lt(promote(a,b)...) == True
Base.isless(a::Number, b::Sym) = sympy.Lt(promote(a,b)...) == True
Base.isless(a::Sym, b::Sym) = (a != sympy.nan && b != sympy.nan) && sympy.Lt(a,b) == True
Base.isless(a::Sym, b::Number) = isless(promote(a,b)...)
Base.isless(a::Number, b::Sym) = isless(promote(a,b)...)

Base.isequal(a::Sym, b::Sym) = Eq(a,b) == True
Base.isequal(a::Sym, b::Number) = Eq(promote(a,b)...) == True
Expand Down
11 changes: 11 additions & 0 deletions test/test-math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,14 @@ using SpecialFunctions
@test eps(Sym) == 0
#@test rewrite(sinc(x), "jn") == jn(0, PI * x)
end

@testset "nan" begin
# issue 346
a=sympy.nan
a′ = NaN

@test (a < 0) == (a′ < 0)
@test (a > 0) == (a′ > 0)
@test (a == 0) == (a′ == 0)

end

2 comments on commit b6c85ed

@jverzani
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/15522

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.21 -m "<description of version>" b6c85eda728c876ae5e1afdb09c8d29edaa00cd6
git push origin v1.0.21

Please sign in to comment.