Skip to content

Commit

Permalink
Merge pull request #268 from JuliaSymbolics/myb/isequal
Browse files Browse the repository at this point in the history
Use `==` for numerical equality
  • Loading branch information
YingboMa authored Apr 7, 2021
2 parents a513057 + 54ecfd4 commit 491ad80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SymbolicUtils"
uuid = "d1185830-fcd6-423d-90d6-eec64667417b"
authors = ["Shashi Gowda"]
version = "0.10.2"
version = "0.10.3"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ function arguments(a::Add)
a.sorted_args_cache[] = iszero(a.coeff) ? args : vcat(a.coeff, args)
end

Base.isequal(a::Add, b::Add) = isequal(a.coeff, b.coeff) && isequal(a.dict, b.dict)
Base.isequal(a::Add, b::Add) = a.coeff == b.coeff && isequal(a.dict, b.dict)

Base.show(io::IO, a::Add) = show_term(io, a)

Expand Down Expand Up @@ -745,7 +745,7 @@ function arguments(a::Mul)
a.sorted_args_cache[] = isone(a.coeff) ? args : vcat(a.coeff, args)
end

Base.isequal(a::Mul, b::Mul) = isequal(a.coeff, b.coeff) && isequal(a.dict, b.dict)
Base.isequal(a::Mul, b::Mul) = a.coeff == b.coeff && isequal(a.dict, b.dict)

Base.show(io::IO, a::Mul) = show_term(io, a)

Expand Down
5 changes: 5 additions & 0 deletions test/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,8 @@ end
@test isequal(x^1, x)
end
end

@testset "isequal" begin
@syms a b c
@test isequal(a + b, a + b + 0.01 - 0.01)
end

2 comments on commit 491ad80

@YingboMa
Copy link
Member 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/33713

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 v0.10.3 -m "<description of version>" 491ad806c8a21b75c11efd930fbce7af0de1fcfe
git push origin v0.10.3

Please sign in to comment.