From adb0aca7d87b9dbf8639f9fa5d8e468271fa955c Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Mon, 23 Sep 2002 19:46:18 +0000 Subject: [PATCH] * numeric::print(): increase precision for C source output. --- ginac/numeric.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 005e57e3..e78a3c05 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -355,6 +355,11 @@ void numeric::print(const print_context & c, unsigned level) const std::ios::fmtflags oldflags = c.s.flags(); c.s.setf(std::ios::scientific); + int oldprec = c.s.precision(); + if (is_a(c)) + c.s.precision(16); + else + c.s.precision(7); if (this->is_rational() && !this->is_integer()) { if (compare(_num0) > 0) { c.s << "("; @@ -382,6 +387,7 @@ void numeric::print(const print_context & c, unsigned level) const c.s << to_double(); } c.s.flags(oldflags); + c.s.precision(oldprec); } else { const std::string par_open = is_a(c) ? "{(" : "("; -- 2.49.0