Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122183490
compute_pi.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 16, 10:34
Size
379 B
Mime Type
text/x-c
Expires
Fri, Jul 18, 10:34 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27446135
Attached To
R7561 SP4E_HW1
compute_pi.cc
View Options
//Class to compute Pi
#include "compute_pi.hh"
#include <cmath>
ComputePi::ComputePi()
:
Series(){};
ComputePi::~ComputePi() {}
double ComputePi::eval_term(unsigned k) {
return 1./(k*k);
}
double ComputePi::compute(unsigned N) {
double tmp=Series::compute(N);
return sqrt(6.*tmp);
}
double ComputePi::getAnalyticPrediction(){
return M_PI;
}
Event Timeline
Log In to Comment