We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5426f7d + 7d5728d commit 9e85a60Copy full SHA for 9e85a60
src/types.jl
@@ -469,7 +469,13 @@ end
469
function show_pow(io, args)
470
base, ex = args
471
472
- print_arg(io, base, paren=true)
+ 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
479
print(io, "^")
480
print_arg(io, ex, paren=true)
481
end
test/basics.jl
@@ -153,6 +153,8 @@ end
153
@test repr((a + b) - (b + c)) == "a - c"
154
@test repr(a + -1*(b + c)) == "a - b - c"
155
@test repr(a + -1*b) == "a - b"
156
+ @test repr(-1^a) == "-(1^a)"
157
+ @test repr((-1)^a) == "(-1)^a"
158
159
160
@testset "similarterm with Add" begin
0 commit comments