Skip to content

Commit 39f08c8

Browse files
committed
print parenthesis around -ve base in pow
1 parent b9843c6 commit 39f08c8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/types.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,13 @@ end
469469
function show_pow(io, args)
470470
base, ex = args
471471

472-
print_arg(io, base, paren=true)
472+
if base isa Real && base < 0
473+
print(io, "(")
474+
print_arg(io, base)
475+
print(io, ")")
476+
else
477+
print_arg(io, base, paren=true)
478+
end
473479
print(io, "^")
474480
print_arg(io, ex, paren=true)
475481
end

0 commit comments

Comments
 (0)