Skip to content

Commit

Permalink
fix integer division bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Fowlie committed Oct 31, 2019
1 parent c0b3e4a commit 8d6505b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/zeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <bernoulli.h>

#include <gsl/gsl_sf.h>
#include <gsl/gsl_math.h>
#include <complex>
#include <stdexcept>

Expand Down Expand Up @@ -109,7 +110,8 @@ cdouble polylog(double s, cdouble a, int N) {
cdouble term = a;
cdouble sum = term;
for (int i = 2; i <= N; i += 1) {
term *= a * pow((i - 1) / i, 2.5);
const double x = (i - 1) / static_cast<double>(i);
term *= a * gsl_pow_2(x) * sqrt(x);
sum += term;
}
return sum;
Expand Down

0 comments on commit 8d6505b

Please sign in to comment.