Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The C modest god

The PI constant

This topic is 5139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I don't think that any of the std headers include a PI constant definition, maybe things have changed, however you can easily do it yourself like this.

Go to calculator. Hit PI. Hit copy. Goto your code. type

#define PI [paste here]

and you have it. That is if you are like me and forget PI after about the 5th digit or so :-) 3.1415...

You can be more savvy and make it a const double PI or whatever, if you want to, I am content with #defines.

Peace

[edited by - PeterTarkus on May 27, 2004 4:25:48 AM]

Share this post


Link to post
Share on other sites
Hmm, maybe VS defines M_PI, but I recall not all compilers do, so I always just define it myself.

Well, whatever works is good :-)

Peace

Share this post


Link to post
Share on other sites
I always forget how to define a static const variable in a class.
So how do I do that?
I define
static const double M_PI;

then outside of the class I need to set its value, but how?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!