@@ -159,6 +159,15 @@ function printproductsign(io::IO, pj::T, j, mimetype) where {T}
159159 (showone (T) || pj != one (T)) && print (io, showop (mimetype, " *" ))
160160end
161161
162+ function printproductsign (io:: IO , pj:: T , j, mimetype) where {T<: Complex }
163+ j == 0 && return
164+ (a,b) = reim (pj)
165+ ! iszero (a) && ! iszero (b) && return # parentheses inserted, no * needed
166+ ! iszero (a) && return printproductsign (io, a, j, mimetype)
167+ print (io, showop (mimetype, " *" ))
168+ end
169+
170+
162171# show a single term
163172# Other types can overload Polynomials.printcofficient with a mimetype
164173# or Base.show_unquoted(io, pj, indent, prec)
@@ -210,7 +219,7 @@ function printcoefficient(io::IO, pj::S, j, mimetype) where {T,S <: Complex{T}}
210219 hasimag = ! iszero (b) || isnan (b) || isinf (b)
211220
212221 if hasreal && hasimag
213- print (io, " (" )
222+ iszero (j) || print (io, " (" )
214223 print (io, a)
215224
216225 # print b
@@ -232,7 +241,7 @@ function printcoefficient(io::IO, pj::S, j, mimetype) where {T,S <: Complex{T}}
232241 end
233242
234243 print (io, imagsymbol (mimetype))
235- print (io, " )" )
244+ iszero (j) || print (io, " )" )
236245
237246 elseif hasreal
238247
0 commit comments