Is PI is #defined in <math.h>? Becuase it isn't with my compiler (Dev-c++ 4.0).

Although it is with DJGPP.

Printable View

- 09-07-2005dwksPI is #defined in <math.h>, right?
Is PI is #defined in <math.h>? Becuase it isn't with my compiler (Dev-c++ 4.0).

Although it is with DJGPP. - 09-07-2005cwr
No, you are looking for M_PI

Actually, I can't find anywhere in the standard that defines it, so you might have M_PI, but I wouldn't rely on it. #define your own? pi isn't likely to change in the near future. :p - 09-08-2005rodrigorulesQuote:

Originally Posted by**cwr**

- 09-08-2005sand_man
PI IS EXACTLY THREE!

Code:`#define PI 3`

- 09-09-2005grumpy
M_PI (like PI) is actually non-standard. But it is a somewhat common extension to math.h

- 09-10-2005Snip
:p

- 09-10-2005dwks
Yeah, I know how to get PI - just open a calculator and click on pi. But I thought PI was defined in <math.h>. I guess I'll just declare it myself.

- 09-10-2005swoopyCode:
`const double pi = 4. * atan(1.);`