• Advertisement

Archived

This topic is now archived and is closed to further replies.

math formula conversion for OpenGL Screen Saver

This topic is 5286 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am doing a PI opengl screen saver in OpenGL. It will calculate PI to infinite decimal places. I have worked on the Machin calculations of PI...... PI = pi=16arctan(1/5)-4arctan(1/239) and got it to run...but it looses precision very fast. anyone know how to translate the following formulas to a useable MACRO or function in C/C++....... 1)Kanada''s pi Calculation: a).Kpi1 := 48*arctan(1/49)+128*arctan(1/57) -20*arctan(1/239)+48*arctan(1/110443); b.)Kpi2 := 176*arctan(1/57)+28*arctan(1/239) -48*arctan(1/682)+96*arctan(1/12943); --Kanada calcualtes PI to a trillion digits (10^12 digits)!!!!! 2.)Newton''s pi Calculation: Pi/24=Int(x^(1/2)*(1-x)^(1/2),x=0..1/4)+sqrt(3)/32; 3.)Sharp''s pi Calculation: a).arctan(1/sqrt(3))=''arctan''(1/sqrt(3)); b).arctan(x)=Sum((-1)^n*x^(2*n+1)/(2*n+1),n=0..infinity);

Share this post


Link to post
Share on other sites
Advertisement
You have to use an arbitrary precision arithmetic package.
My favorite is "apfloat" [ http://www.apfloat.org/ ].

Share this post


Link to post
Share on other sites

  • Advertisement