- if (precedence <= upper_precedence)
- os << ")";
- }
- }
-}
-
-
-void numeric::printraw(std::ostream &os) const
-{
- // The method printraw doesn't do much, it simply uses CLN's operator<<()
- // for output, which is ugly but reliable. e.g: 2+2i
- debugmsg("numeric printraw", LOGLEVEL_PRINT);
- os << class_name() << "(" << cln::the<cln::cl_N>(value) << ")";
-}
-
-
-void numeric::printtree(std::ostream &os, unsigned indent) const
-{
- debugmsg("numeric printtree", LOGLEVEL_PRINT);
- os << std::string(indent,' ') << cln::the<cln::cl_N>(value)
- << " (numeric): "
- << "hash=" << hashvalue
- << " (0x" << std::hex << hashvalue << std::dec << ")"
- << ", flags=" << flags << std::endl;
-}
-
-
-void numeric::printcsrc(std::ostream &os, unsigned type, unsigned upper_precedence) const
-{
- debugmsg("numeric print csrc", LOGLEVEL_PRINT);
- std::ios::fmtflags oldflags = os.flags();
- os.setf(std::ios::scientific);
- if (this->is_rational() && !this->is_integer()) {
- if (compare(_num0()) > 0) {
- os << "(";
- if (type == csrc_types::ctype_cl_N)
- os << "cln::cl_F(\"" << numer().evalf() << "\")";
- else
- os << numer().to_double();
- } else {
- os << "-(";
- if (type == csrc_types::ctype_cl_N)
- os << "cln::cl_F(\"" << -numer().evalf() << "\")";
- else
- os << -numer().to_double();