Skip to content

Commit 7720d10

Browse files
shashiblegat
andcommitted
Allow any number as a coefficient
Co-authored-by: "Benoit Legat" <[email protected]>
1 parent 74c05dd commit 7720d10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/abstractalgebra.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function labels!(dicts, t::Sym, variable_type::Type)
1919
end
2020

2121
function labels!(dicts, t, variable_type::Type)
22-
if t isa Integer
22+
if t isa Number
2323
return t
2424
elseif istree(t) && (operation(t) == (*) || operation(t) == (+) || operation(t) == (-))
2525
tt = arguments(t)
@@ -49,7 +49,7 @@ function labels!(dicts, t, variable_type::Type)
4949
end
5050
end
5151

52-
ismpoly(x) = x isa MP.AbstractPolynomialLike || x isa Integer
52+
ismpoly(x) = x isa MP.AbstractPolynomialLike || x isa Number
5353
isnonnegint(x) = x isa Integer && x >= 0
5454

5555
_dicts(t2s=OrderedDict{Any, Sym}()) = (OrderedDict{Sym, Any}(), t2s)
@@ -127,7 +127,7 @@ function _to_term(reference, term::MP.AbstractTermLike, dict, syms)
127127
if isone(coef)
128128
return mono
129129
else
130-
return Int(MP.coefficient(term)) * mono
130+
return MP.coefficient(term) * mono
131131
end
132132
end
133133

0 commit comments

Comments
 (0)