git://www.ginac.de
/
ginac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e090988
)
* numeric::print(): increase precision for C source output.
author
Richard Kreckel
<Richard.Kreckel@uni-mainz.de>
Mon, 23 Sep 2002 19:45:56 +0000
(19:45 +0000)
committer
Richard Kreckel
<Richard.Kreckel@uni-mainz.de>
Mon, 23 Sep 2002 19:45:56 +0000
(19:45 +0000)
ginac/numeric.cpp
patch
|
blob
|
history
diff --git
a/ginac/numeric.cpp
b/ginac/numeric.cpp
index 000e15f8eb53acbb71277692a103dc28ca95b949..0274d63af6fcee55c222c507253a7f124a53d8c5 100644
(file)
--- a/
ginac/numeric.cpp
+++ b/
ginac/numeric.cpp
@@
-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) ? "{(" : "(";