aboutsummaryrefslogtreecommitdiff
path: root/ci-tests/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'ci-tests/hello.c')
-rw-r--r--ci-tests/hello.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ci-tests/hello.c b/ci-tests/hello.c
new file mode 100644
index 0000000..cf10e80
--- /dev/null
+++ b/ci-tests/hello.c
@@ -0,0 +1,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;
+}