From: Christian Bauer Date: Fri, 25 Oct 2002 18:16:09 +0000 (+0000) Subject: improved the CLN C-source output (integers are printed as integers, and X-Git-Tag: release_1-0-12~6 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=7e7beee2c946694130a484c923f6af8391867495;ds=sidebyside improved the CLN C-source output (integers are printed as integers, and floating point numbers include the precision) --- diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 858cbbd5..a9f1c67b 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -359,7 +359,12 @@ void numeric::print(const print_context & c, unsigned level) const c.s.precision(16); else c.s.precision(7); - if (this->is_rational() && !this->is_integer()) { + if (is_a(c) && this->is_integer()) { + c.s << "cln::cl_I(\""; + const cln::cl_R r = cln::realpart(cln::the(value)); + print_real_number(c,r); + c.s << "\")"; + } else if (this->is_rational() && !this->is_integer()) { if (compare(_num0) > 0) { c.s << "("; if (is_a(c)) @@ -381,7 +386,7 @@ void numeric::print(const print_context & c, unsigned level) const c.s << ")"; } else { if (is_a(c)) - c.s << "cln::cl_F(\"" << evalf() << "\")"; + c.s << "cln::cl_F(\"" << evalf() << "_" << Digits << "\")"; else c.s << to_double(); }