Hi, I have problem with sin(),cos(),when used them to find sin() of angle (90) the result not correct. what shuld i do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi, I have problem with sin(),cos(),when used them to find sin() of angle (90) the result not correct. what shuld i do?

22nd Sep 2017, 7:08 PM
Awadh Abdullah
2 Answers
+ 6
The angle likely needs to be in radians. I assume you want the result to equal 1? This is sin(PI / 2). To convert an angle to radians you do: R = (A * PI / 180) Where A is the angle, R is radian, PI is the constant 3.14... So, R = 90 * PI / 180 R = PI / 2
22nd Sep 2017, 7:22 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
sin/cos/tan/etc work in radians, not degrees. 2π radians == 360 degrees. So Math.Sin(90) wouldn't be 1, but Math.Sin(Math.PI/2), which is a right angle in radians, would. To convert from radians to degrees, use x * 360 / (2 * Math.PI) or x * 180 / Math.PI I hope that makes sense!
22nd Sep 2017, 7:18 PM
Schindlabua
Schindlabua - avatar