Page MenuHomec4science

compute_pi.cc
No OneTemporary

File Metadata

Created
Sat, Jun 8, 01:39

compute_pi.cc

#include "compute_pi.hh"
double compute_pi::compute(unsigned int N)
{
double S = 0.0;
if (N != 0)
{
for (int i = 1; i <= N; i++)
{
S += 1.0/pow(double(i),2);
}
}
S=sqrt(6.0*S);
return S;
}
double compute_pi::getAnalyticPrediction()
{
return M_PI;
}

Event Timeline