]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns_zeta.cpp
- ASSERT macro renamed to GINAC_ASSERT
[ginac.git] / ginac / inifcns_zeta.cpp
index 8dbe5d2da58da0e7f263859acf3b3e087c3ec0fc..1a850ac43ebfe7f9dac2583eee6fac7b2afebf96 100644 (file)
@@ -39,9 +39,10 @@ namespace GiNaC {
 static ex zeta_eval(ex const & x)
 {
     if (x.info(info_flags::numeric)) {
+        numeric y = ex_to_numeric(x);
         // trap integer arguments:
-        if (x.info(info_flags::integer)) {
-            if (x.is_zero())
+        if (y.is_integer()) {
+            if (y.is_zero())
                 return -exHALF();
             if (!x.compare(exONE()))
                 throw(std::domain_error("zeta(1): infinity"));
@@ -49,20 +50,18 @@ static ex zeta_eval(ex const & x)
                 if (x.info(info_flags::odd))
                     return zeta(x).hold();
                 else
-                    // return bernoulli(ex_to_numeric(x))*pow(Pi,x)*numTWO().power(ex_to_numeric(x))/factorial(x);
-                    throw (std::domain_error("you found a missing feature"));
+                    return abs(bernoulli(y))*pow(Pi,x)*numTWO().power(y-numONE())/factorial(y);
             } else {
                 if (x.info(info_flags::odd))
-                    // return -bernoulli(1-ex_to_numeric(x))/(1-ex_to_numeric(x))
-                    throw (std::domain_error("you found a missing feature"));
-                else 
+                    return -bernoulli(numONE()-y)/(numONE()-y);
+                else
                     return numZERO();
             }
         }
     }
     return zeta(x).hold();
 }
-    
+
 static ex zeta_evalf(ex const & x)
 {
     BEGIN_TYPECHECK
@@ -74,7 +73,7 @@ static ex zeta_evalf(ex const & x)
 
 static ex zeta_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
     
     return exZERO();  // should return zeta(numONE(),x);
 }