Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

M_PI replacent

807575Feb 5 2006 — edited Feb 6 2006
Dear forum,

while porting some code from gcc to CC5, I noted that the g++ viable way
#include <cmath>

float zero = std::sin (M_PI);
will not work on CC5 and
#include <math.h>
has to be used instead.

Is there some more compliant way to access pi instead of using the M_PI macro?

It would be nice if it existed because the M_PI doesn't know anything about its type and you're not warned when doing the wrong assignment. Weird things could happen.

Cheers & thanks, Peter.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2006
Added on Feb 5 2006
2 comments
149 views