Why Nostr?What is Njump?
kunigaku
npub1rg6…lxfh
2024-01-13 11:38:27

kunigaku on Nostr: /run c #include <stdio.h> void calculatePi(int precision) { int carry = 0; int ...

/run c

#include <stdio.h>

void calculatePi(int precision) {
int carry = 0;
int result[precision + 1];

for (int i = 0; i <= precision; ++i) {
result[i] = 2;
}

for (int i = precision; i > 0; i -= 14) {
int sum = 0;

for (int j = i; j > 0; --j) {
sum = sum * j + 10000 * result[j];
result[j] = sum % (j * 2 - 1);
sum /= (j * 2 - 1);
}

printf("%.4d", carry + sum / 10000);
carry = sum % 10000;
}
}

int main() {
calculatePi(5000);
return 0;
}
Author Public Key
npub1rg6m2nhhw5402n9vhmklpu6fuvs0pghw2q2z3qcnfslwxxreeecsvhlxfh