From: Jens Vollinga Date: Thu, 21 Apr 2005 15:38:36 +0000 (+0000) Subject: Nicer output for factorial(). X-Git-Tag: release_1-4-0~182 X-Git-Url: https://ginac.de/ginac.git/static/gitweb.css/ginac.git?a=commitdiff_plain;h=f1dedbe2e079cc7aa0bf34445aa920e9a9046ee5;p=ginac.git Nicer output for factorial(). --- diff --git a/ginac/inifcns.cpp b/ginac/inifcns.cpp index b576ebcf..ad4e035a 100644 --- a/ginac/inifcns.cpp +++ b/ginac/inifcns.cpp @@ -467,6 +467,17 @@ static ex factorial_eval(const ex & x) return factorial(x).hold(); } +static void factorial_print_dflt_latex(const ex & x, const print_context & c) +{ + if (is_exactly_a(x) || + is_exactly_a(x) || + is_exactly_a(x)) { + x.print(c); c.s << "!"; + } else { + c.s << "("; x.print(c); c.s << ")!"; + } +} + static ex factorial_conjugate(const ex & x) { return factorial(x); @@ -474,6 +485,8 @@ static ex factorial_conjugate(const ex & x) REGISTER_FUNCTION(factorial, eval_func(factorial_eval). evalf_func(factorial_evalf). + print_func(factorial_print_dflt_latex). + print_func(factorial_print_dflt_latex). conjugate_func(factorial_conjugate)); //////////