]> 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:45:56 +0000 (19:45 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Mon, 23 Sep 2002 19:45:56 +0000 (19:45 +0000)
ginac/numeric.cpp

index 000e15f8eb53acbb71277692a103dc28ca95b949..0274d63af6fcee55c222c507253a7f124a53d8c5 100644 (file)
@@ -354,6 +354,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 << "(";
@@ -381,6 +386,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) ? "{(" : "(";