I like radians just like the next guy, and usually prefer to use them in degrees, but why do we use radians in programming?
To rotate something 180 degrees, you need to rotate it 3.14159265...
Of course, most languages have some kind of constant for pi, but why do we ever want to use irrational numbers like pi when we can use integers instead, especially for simple programs?
We rely on the computer to say that 3.14159265
is close enough to pi, which performs functions such as sine and cosine, returns the correct values, but if the computer is too accurate, then the values will be slightly turned off ( sin(3.14159265) = 0.00000000358979303
). This is not a problem when using 180 degrees.
source share