From: Chris Dams Date: Mon, 11 Dec 2006 18:51:37 +0000 (+0000) Subject: Make eval do evalf if arguments of gamma or beta are floats. X-Git-Tag: release_1-4-0~45 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=d9eaa10644d2f0d000b8cbae47d8544fcf646f91 Make eval do evalf if arguments of gamma or beta are floats. --- diff --git a/ginac/inifcns_gamma.cpp b/ginac/inifcns_gamma.cpp index c9adc199..2770193f 100644 --- a/ginac/inifcns_gamma.cpp +++ b/ginac/inifcns_gamma.cpp @@ -54,8 +54,7 @@ static ex lgamma_evalf(const ex & x) /** Evaluation of lgamma(x), the natural logarithm of the Gamma function. - * Knows about integer arguments and that's it. Somebody ought to provide - * some good numerical evaluation some day... + * Handles integer arguments as a special case. * * @exception GiNaC::pole_error("lgamma_eval(): logarithmic pole",0) */ static ex lgamma_eval(const ex & x) @@ -69,7 +68,8 @@ static ex lgamma_eval(const ex & x) else throw (pole_error("lgamma_eval(): logarithmic pole",0)); } - // lgamma_evalf should be called here once it becomes available + if (!ex_to(x).is_rational()) + return lgamma(ex_to(x)); } return lgamma(x).hold(); @@ -165,7 +165,8 @@ static ex tgamma_eval(const ex & x) return (pow(*_num_2_p, n).div(doublefactorial(n.mul(*_num2_p).sub(*_num1_p))))*sqrt(Pi); } } - // tgamma_evalf should be called here once it becomes available + if (!ex_to(x).is_rational()) + return tgamma(ex_to(x)); } return tgamma(x).hold(); @@ -262,7 +263,8 @@ static ex beta_eval(const ex & x, const ex & y) (nx+ny).is_integer() && !(nx+ny).is_positive()) return _ex0; - // beta_evalf should be called here once it becomes available + if (!ex_to(x).is_rational() || !ex_to(x).is_rational()) + return evalf(beta(x, y).hold()); } return beta(x,y).hold();