Skip to content

Commit 8b5aed2

Browse files
committed
special treatment for negative powers in simplify_fractions
1 parent fe731b5 commit 8b5aed2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/polyform.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,14 @@ add_divs(x, y::Div) = (x * y.den + y.num) / y.den
275275
add_divs(x, y) = x + y
276276

277277
function frac_similarterm(x, f, args; kw...)
278-
if f in (*, /, \, +, -, ^)
278+
if f in (*, /, \, +, -)
279279
f(args...)
280+
elseif f == (^)
281+
if args[2] isa Integer && args[2] < 0
282+
1/((args[1])^(-args[2]))
283+
else
284+
args[1]^args[2]
285+
end
280286
else
281287
similarterm(x, f, args; kw...)
282288
end

0 commit comments

Comments
 (0)