Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access math constants (eg. M_PI) in Visual C++ 2008?

Tags:

I want to use the math constants, such as M_PI and M_E, in Visual C++ 2008. I assumed they were defined in the cmath header.

like image 926
batty Avatar asked Apr 30 '09 09:04

batty


People also ask

What is M_PI in C programming?

M_PI. Pi, the ratio of a circle's circumference to its diameter. M_PI_2. Pi divided by two.


1 Answers

They are, but you also need to #define _USE_MATH_DEFINES before you #include <cmath>

like image 199
davidi Avatar answered Sep 21 '22 12:09

davidi