Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82356073
compute_arithmetic.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
Tue, Sep 10, 23:01
Size
637 B
Mime Type
text/x-c
Expires
Thu, Sep 12, 23:01 (2 d)
Engine
blob
Format
Raw Data
Handle
20685121
Attached To
R7571 SP4E-TB-TL-FR
compute_arithmetic.cc
View Options
#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
Log In to Comment