Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int getIndex(const double x) {
- return ((int)(round(x * 100))) % 100;
- }
- double function(const double *values, const int size, const double x) {
- if (values == NULL || size < 100 || x < 1.0){
- return 0;
- }
- if (x >= 1.0 && x < 2.0) {
- return values[getIndex(x)];
- } else {
- return x * function(values, size, x - 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment