So, you might have already seen @StudentFires 's attempt at a fast and accurate π approximation in C++...
So, here are two actually fast and accurate π approximations in C:
The repl linked to this post is the most accurate and is found at https://repl.it/@AmazingMech2418/p-in-C and the other is https://repl.it/@AmazingMech2418/p-in-C-2.
The first one uses trapezoidal sums while the other uses the Nilakantha Series.
Update: The second one was updated to make it faster. It gets to 16 places very quickly.
@AmazingMech2418 nah man. deleted the source code after i found i lost. Sorry about that.I used the x * sin(180/x) method of pi.
π Approximations in C
So, you might have already seen @StudentFires 's attempt at a fast and accurate π approximation in C++...
So, here are two actually fast and accurate π approximations in C:
The repl linked to this post is the most accurate and is found at https://repl.it/@AmazingMech2418/p-in-C and the other is https://repl.it/@AmazingMech2418/p-in-C-2.
The first one uses trapezoidal sums while the other uses the Nilakantha Series.
Update: The second one was updated to make it faster. It gets to 16 places very quickly.
@AmazingMech2418 nah man. deleted the source code after i found i lost. Sorry about that.
I used the x * sin(180/x) method of pi.