aboutsummaryrefslogtreecommitdiff
path: root/ci-tests/hello.c
blob: cf10e808f82838ecac346cc44a0c97748ec1e77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

int main()
{
  // As a simple benchmark, estimate pi
  int n = 16384, misses = 0;

  for (int i = 0; i < n; i++) {

    for (int j = 0; j < n; j++) {
      int x = i - (n / 2);
      int y = j - (n / 2);

      misses += (x * x + y * y >= (n / 2) * (n / 2));
    }
  }

  double pi = 4.0 * (n * n - misses) / (n * n);

  printf("Hello, world!  Pi is approximately %f.\n", pi);

  return 0;
}