fork download
  1. #include <stdio.h>
  2.  
  3. float sum(float *p, int n) {
  4. if (n == 1) return *p;
  5. for (int i = 0; i < n/2; i++) {
  6. p[i] += p[i+n/2];
  7. }
  8. return sum(p, n/2);
  9. }
  10.  
  11. int main(void) {
  12. float x[1024*1024];
  13. for (int i = 0; i < 1024*1024; i++) {
  14. x[i] = 30504.00005f;
  15. }
  16.  
  17. float acc = sum(x, 1024*1024);
  18.  
  19. acc /= (1024*1024);
  20. printf("%f\n", acc);
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5800KB
stdin
Standard input is empty
stdout
30504.000000