2 Different Radians constant calculations what's the difference?

67 views Asked by At

Most commonly I see in programs that convert radians to degrees and degrees to radians for trigonometry people always use two different ways to get the radian constant.

double PI = 3.14159265358979;
double Radians = (2 * PI) / 360;

Most commonly I see the one shown below:

double Radians = PI / 180;

From my understanding they both seem to generate the same value, but it seems that the one with 360 looks better. After all it's the angle for a full circle and the other one uses the 180 which is half the circle, also I always learned that PI is for calculating distances in circles so multiplying it by 2 makes no sense to me.

Only thing I can understand from this is that it's some kind of scaling going on here to generate same results.
But shouldn't they both give a little difference anyway?
Since PI is a irrational number, meaning the 180 variant should be less precise?
Yeah my math logic are not good sorry about that.

1

There are 1 answers

0
MikeD On BEST ANSWER

I think it's just preferential. The first way more closely maps to what you might have learned in school algebra ("there are 2*PI radians in a circle") - it makes explicit what the calculation is. The 2nd way is a reduction of the first. On a modern compiler, both should be equally efficient (though I'd use floating point constants instead of ints). Bottom line: no important difference.