Page MenuHomec4science

compute_arithmetic.cc
No OneTemporary

File Metadata

Created
Tue, Sep 10, 23:01

compute_arithmetic.cc

#include <iostream>
#include "compute_arithmetic.hh"
// Implement summation serie
// double ComputeArithmetic::compute(unsigned int N) {
// double sum = 0;
// for (float k = 1; k < N + 1; k++){
// number_of_operations += 1;
// sum += k;
// }
// return sum;
// }
double ComputeArithmetic::compute(unsigned int N) {
for (float k = current_index+1; k < N + 1; k++){
number_of_operations += 1;
current_value += k;
}
current_index = N;
return current_value;
}
// Get name of the implemented serie
std::string ComputeArithmetic::getName() {
return "ComputeArithmetic";
}

Event Timeline