Trigonometry Functions in C++

Is C++ in radians or degrees mode by default, and if in radians, how do i convert it into degrees?
Trigonometric functions in the cmath header accept parameters in radians. This is typical behavior in all or nearly all programming languages.

radians = degrees * (pi / 180)
Last edited on
Trigonometric functions are in radians.
1 radian = 180/π degrees.

1
2
3
4
5
6
7
8
9
#define PI 3.14159265358979323846
double DEG2RAD( const double deg )
{
	return deg * PI/180
}
double RAD2DEG( const double rad )
{
	return rad * 180/PI
}
Topic archived. No new replies allowed.