Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64815625
compute_arithmetic.hh
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, May 29, 16:16
Size
467 B
Mime Type
text/x-c++
Expires
Fri, May 31, 16:16 (2 d)
Engine
blob
Format
Raw Data
Handle
17962747
Attached To
R9484 sp4e-homework-lars-bertil
compute_arithmetic.hh
View Options
#ifndef COMPUTEARITHMETIC_HPP
#define COMPUTEARITHMETIC_HPP
#include "series.hh"
class ComputeArithmetic : public Series {
public:
//PREVIOUS IMPLEMENTATION:
//double compute(unsigned int N) {
// double result = 0;
// for (int a = 1; a<=N; ++a) {
// result=result+a;
// }
// return result;
//}
double computeValue(int k) {
return 1.*k;
}
double getAnalyticPrediction() {
return 1.*current_index*(current_index+1.)/2.;
}
};
#endif
Event Timeline
Log In to Comment