Skip to content

Commit

Permalink
Use == for numerical equality
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Apr 7, 2021
1 parent a513057 commit 54ecfd4
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

0 comments on commit 54ecfd4

Please sign in to comment.