From: Richard Kreckel Date: Sat, 26 Jan 2002 16:29:42 +0000 (+0000) Subject: * numeric::print(): Treat imaginary numbers correctly. X-Git-Tag: release_1-0-6~9 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=bb2670b06c0f98ef1a4fcb193826d65363a302dd * numeric::print(): Treat imaginary numbers correctly. --- diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index f2a834d2..55d5d556 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -403,25 +403,19 @@ void numeric::print(const print_context & c, unsigned level) const } else { if (cln::zerop(r)) { // case 2, imaginary: y*I or -y*I - if ((precedence() <= level) && (i < 0)) { - if (i == -1) { - c.s << par_open+imag_sym+par_close; - } else { + if (i==1) + c.s << imag_sym; + else { + if (precedence()<=level) c.s << par_open; + if (i == -1) + c.s << "-" << imag_sym; + else { print_real_number(c, i); - c.s << mul_sym+imag_sym+par_close; - } - } else { - if (i == 1) { - c.s << imag_sym; - } else { - if (i == -1) { - c.s << "-" << imag_sym; - } else { - print_real_number(c, i); - c.s << mul_sym+imag_sym; - } + c.s << mul_sym+imag_sym; } + if (precedence()<=level) + c.s << par_close; } } else { // case 3, complex: x+y*I or x-y*I or -x+y*I or -x-y*I