DSPRelated.com
Forums

Happy Pi Day

Started by Cedron 7 years ago7 replieslatest reply 7 years ago135 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

[ - ]
Reply by JohnEhlersMarch 15, 2017

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.

[ - ]
Reply by edmond_stuartMarch 15, 2017

Nice! The first 7 digits are correct, indeed.


[ - ]
Reply by kazMarch 15, 2017

you missed (2 + 15 = 17), (1 +16 = 17) ...

[ - ]
Reply by CedronMarch 15, 2017

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

[ - ]
Reply by TreefarmerMarch 15, 2017

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.

[ - ]
Reply by CedronMarch 15, 2017

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

[ - ]
Reply by TreefarmerMarch 15, 2017

Good point.