Reputation: 1553
I have the following calculations:
let sinX = sin(150.0) //returns -0,71487
let cosY = cos(150.0) // returns 0,699250
But the real values for sinX = 0,5 and for cosY = -0,86.
Does anybody know where is the error?
Upvotes: 2
Views: 387
Reputation: 43
And are you sure the sin & cos methods haven't been redefined by creating or overriding the default methods. That happens in programming. If so, you might want to re-check your operation.
Upvotes: 1
Reputation: 1932
The calculation is correct. However sin
and cos
take their param in radians, not degrees.
In calculus and most other branches of mathematics beyond practical geometry, angles are universally measured in radians. One radian is equal to 180/π degrees.
To convert from radians to degrees, multiply by 180/π.
https://en.wikipedia.org/wiki/Radian
Upvotes: 6