## Happy Pi Day

Started by 7 years ago7 replieslatest reply 7 years ago140 views

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.

Ced

[ - ]

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!

Regards,

Ced

[ - ]

Here's a cool way to define PI in a C program. Instead of saying
#define PI 3.14159265
do this:

#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.

Ced

[ - ]