Troll Kingdom

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

OMG.

Eggs Mayonnaise said:
I like pi.


You should be able to compile/run this C program on any system.

/* Calculate PI */


#define SHIFT_ACC 10000
#define SHIFT_LUT 2800

int main(void)
{
int grad=0;
int mant=0;
int base=0;
int divshift=0;
int accum=SHIFT_ACC;
int radi=SHIFT_LUT;
int lut[SHIFT_LUT+1];

while(base-radi)
lut[base++]=accum/5;

while(grad=radi*2)
{
for(base=radi;divshift+=lut[base]*accum,lut[base]=(divshift%--grad),
divshift /= grad--,--base;divshift*=base);

radi-=14;
printf("%.4d", mant + (divshift/accum));
mant = (divshift%accum);
}
}




3.1415926535897932384626433832795028841971693993751058209749445923078164062862089
98628034825342117067982148086513282306647093844609550582231725359408128481117450
28410270193852110555964462294895493038196442881097566593344612847564823378678316
52712019091456485669234603486104543266482133936072602491412737245870066063155881
74881520920962829254091715364367892590360011330530548820466521384146951941511609
43305727036575959195309218611738193261179310511854807446237996274956735188575272
48912279381830119491298336733624406566430860213949463952247371907021798609437027
70539217176293176752384674818467669405132000568127145263560827785771342757789609
17363717872146844090122495343014654958537105079227968925892354201995611212902196
08640344181598136297747713099605187072113499999983729780499510597317328160963185
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 96892589235420199
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 968925892354201993
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 9689258923542019911854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 96892589235420199
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 96892583567365735
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176296436433467437437789609
17363717872146844090122495343014654958537105079227 96892589235420199
 
11854 807446237996274956735188575272
4891226484647870965874350932475032984753204985734098565d7r4e8765876r98769876976976
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907045864586756876586565876587765876855132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 96892589235420199
 
74511854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 9689258923542019947456
 
11854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 968925892354201993452435
 
3657365779811854 807446237996274956735188575272
48912279381830119491298336733624406566430860213949 463952247371907021798609437027
70539217176293176752384674818467669405132000568127 145263560827785771342757789609
17363717872146844090122495343014654958537105079227 96892589235420199
 
Back
Top