+void numeric::do_print(const print_context & c, unsigned level) const
+{
+ print_numeric(c, "(", ")", "I", "*", level);
+}
+
+void numeric::do_print_latex(const print_latex & c, unsigned level) const
+{
+ print_numeric(c, "{(", ")}", "i", " ", level);
+}
+
+void numeric::do_print_csrc(const print_csrc & c, unsigned level) const
+{
+ std::ios::fmtflags oldflags = c.s.flags();
+ c.s.setf(std::ios::scientific);
+ int oldprec = c.s.precision();
+
+ // Set precision
+ if (is_a<print_csrc_double>(c))
+ c.s.precision(std::numeric_limits<double>::digits10 + 1);
+ else
+ c.s.precision(std::numeric_limits<float>::digits10 + 1);
+
+ if (this->is_real()) {
+
+ // Real number
+ print_real_csrc(c, cln::the<cln::cl_R>(value));
+
+ } else {
+
+ // Complex number
+ c.s << "std::complex<";
+ if (is_a<print_csrc_double>(c))
+ c.s << "double>(";
+ else
+ c.s << "float>(";
+
+ print_real_csrc(c, cln::realpart(value));
+ c.s << ",";
+ print_real_csrc(c, cln::imagpart(value));
+ c.s << ")";
+ }
+
+ c.s.flags(oldflags);
+ c.s.precision(oldprec);
+}
+
+void numeric::do_print_csrc_cl_N(const print_csrc_cl_N & c, unsigned level) const
+{
+ if (this->is_real()) {
+
+ // Real number
+ print_real_cl_N(c, cln::the<cln::cl_R>(value));
+
+ } else {
+
+ // Complex number
+ c.s << "cln::complex(";
+ print_real_cl_N(c, cln::realpart(value));
+ c.s << ",";
+ print_real_cl_N(c, cln::imagpart(value));
+ c.s << ")";
+ }
+}
+
+void numeric::do_print_tree(const print_tree & c, unsigned level) const
+{
+ c.s << std::string(level, ' ') << value
+ << " (" << class_name() << ")" << " @" << this
+ << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+ << std::endl;
+}
+
+void numeric::do_print_python_repr(const print_python_repr & c, unsigned level) const
+{
+ c.s << class_name() << "('";
+ print_numeric(c, "(", ")", "I", "*", level);
+ c.s << "')";
+}
+