Forum Discussion
Altera_Forum
Honored Contributor
18 years agocalculate pi in verilog
Im trying to develop a system which will calculate pi using verilog and using the Gregory Leibniz series. this is the equation pi = 4 x ( (-1)^n / 2n+1 ); where n = 0 to infinity ive tri...
Altera_Forum
Honored Contributor
18 years agoHi,
The formula you are after is actually a summation of the term you mentioned for n = O to infinity. The (-1)^n is not difficult since you can use -1 if n is odd ot +1 if n is even. Or since you need to increment n every time, you can toggle the sign for every n. The biggest issue you will have is the division. If you need a bright new idea to calculate pi, don't start with Liebniz, since --- Quote Start --- Calculating π to 10 correct decimal places using Leibniz' formula requires over 10,000,000,000 mathematical operations, and will take longer for most computers to calculate than calculating π to millions of digits using more efficient formulas. --- Quote End --- Stefaan