Skip to content

Instantly share code, notes, and snippets.

@ramntry
Created July 18, 2018 05:39
Show Gist options
  • Save ramntry/61be4548d43bdaaf99f3a5a8d951528b to your computer and use it in GitHub Desktop.
Save ramntry/61be4548d43bdaaf99f3a5a8d951528b to your computer and use it in GitHub Desktop.
double foo(double *a, int n) {
double x = 0.0;
double y = 0.0;
for (int i = 0; i < n; i += 2) {
x += a[i];
y += a[i + 1];
}
return x * y;
}
double bar(double *a, unsigned n) {
double x = 0.0;
double y = 0.0;
for (unsigned i = 0; i < n; i += 2) {
x += a[i];
y += a[i + 1];
}
return x * y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment