- if (x.info(info_flags::numeric)) {
- numeric y = ex_to_numeric(x);
- // trap integer arguments:
- if (y.is_integer()) {
- if (y.is_zero())
- return -exHALF();
- if (x.is_equal(exONE()))
- throw(std::domain_error("zeta(1): infinity"));
- if (x.info(info_flags::posint)) {
- if (x.info(info_flags::odd))
- return zeta(x).hold();
- else
- return abs(bernoulli(y))*pow(Pi,x)*numTWO().power(y-numONE())/factorial(y);
- } else {
- if (x.info(info_flags::odd))
- return -bernoulli(numONE()-y)/(numONE()-y);
- else
- return numZERO();
- }
- }
- }
- return zeta(x).hold();
+ if (x.info(info_flags::numeric)) {
+ numeric y = ex_to_numeric(x);
+ // trap integer arguments:
+ if (y.is_integer()) {
+ if (y.is_zero())
+ return -_ex1_2();
+ if (x.is_equal(_ex1()))
+ throw(std::domain_error("zeta(1): infinity"));
+ if (x.info(info_flags::posint)) {
+ if (x.info(info_flags::odd))
+ return zeta(x).hold();
+ else
+ return abs(bernoulli(y))*pow(Pi,x)*pow(_num2(),y-_num1())/factorial(y);
+ } else {
+ if (x.info(info_flags::odd))
+ return -bernoulli(_num1()-y)/(_num1()-y);
+ else
+ return _num0();
+ }
+ }
+ }
+ return zeta(x).hold();