// N-Body simulation benchmark - floating point compute
#include <stdio.h>
#include <math.h>

double simulate(int steps) {
    double x = 0.0, y = 100.0;
    double vx = 0.0, vy = 6.28;
    double dt = 0.01;

    for (int i = 0; i < steps; i++) {
        double r2 = x * x + y * y;
        double r = sqrt(r2);
        double f = 1000.0 / r2;

        double ax = -f * x / r;
        double ay = -f * y / r;

        vx += ax * dt;
        vy += ay * dt;
        x += vx * dt;
        y += vy * dt;
    }

    return sqrt(x * x + y * y);
}

int main() {
    double finalDistance = simulate(100000);
    printf("Final orbital distance: %f\n", finalDistance);
    return 0;
}
