Skip to content

Commit 491ad80

Browse files
authored
Merge pull request #268 from JuliaSymbolics/myb/isequal
Use `==` for numerical equality
2 parents a513057 + 54ecfd4 commit 491ad80

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SymbolicUtils"
22
uuid = "d1185830-fcd6-423d-90d6-eec64667417b"
33
authors = ["Shashi Gowda"]
4-
version = "0.10.2"
4+
version = "0.10.3"
55

66
[deps]
77
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"

src/types.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ function arguments(a::Add)
602602
a.sorted_args_cache[] = iszero(a.coeff) ? args : vcat(a.coeff, args)
603603
end
604604

605-
Base.isequal(a::Add, b::Add) = isequal(a.coeff, b.coeff) && isequal(a.dict, b.dict)
605+
Base.isequal(a::Add, b::Add) = a.coeff == b.coeff && isequal(a.dict, b.dict)
606606

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

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

748-
Base.isequal(a::Mul, b::Mul) = isequal(a.coeff, b.coeff) && isequal(a.dict, b.dict)
748+
Base.isequal(a::Mul, b::Mul) = a.coeff == b.coeff && isequal(a.dict, b.dict)
749749

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

test/basics.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,8 @@ end
197197
@test isequal(x^1, x)
198198
end
199199
end
200+
201+
@testset "isequal" begin
202+
@syms a b c
203+
@test isequal(a + b, a + b + 0.01 - 0.01)
204+
end

0 commit comments

Comments
 (0)