A special day just for all us techie types.
Today is also sum day. ( 3 + 14 = 17 ) So, if you have something you've been putting off till sum day, git er done.
Can't remember PI? Write out the first three odd digits twice, as: 113355 Now, divide the first three digits into the last three digits like you did in grade school. Amazingly accurate.
Nice! The first 7 digits are correct, indeed.
you missed (2 + 15 = 17), (1 +16 = 17) ...
I should have said "a sum day". Yep, we get one every month for quite a few years yet. However, today is especially special because it is the only Pi day that will fall on sum day in this century. Time to celebrate!
Here's a cool way to define PI in a C program. Instead of saying
#define PI 3.14159265
#define PI 4 * atan(1)
It computes Pi at compile time with maximum accuracy.
That's a good hint, but you want to wrap another set of parentheses around it like this:
#define PI ( 4 * atan(1) )
Otherwise statements like this will not give you the results you desire:
Factor = N / PI;
In Linux, M_PI is available from the Math library.