]> www.ginac.de Git - ginac.git/commitdiff
* numeric::print(): increase precision for C source output.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Mon, 23 Sep 2002 19:46:18 +0000 (19:46 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Mon, 23 Sep 2002 19:46:18 +0000 (19:46 +0000)
ginac/numeric.cpp

index 005e57e38b921719a0f32d90b0065b5b563ff37b..e78a3c05da130cf0e96905d0453b40fca28c1513 100644 (file)
@@ -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<print_csrc_double>(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<print_latex>(c) ? "{(" : "(";