+ 1

I can't understand, why do sin(x) and tan(x) return wrong values when I put Math.PI as x. It shows 1,22 for sin and -1,22 for tan, when it should be 0 in both cases?

24th Dec 2015, 12:51 AM
astar95
astar95 - avatar
3 Answers
+ 2
By default x is not in degree mode its in radians, and returning radians value
25th Dec 2015, 2:15 PM
Ankush Kumar
Ankush Kumar - avatar
0
Ankush +1. Always pay attention either radians or degrees are used in math function.
13th Jul 2016, 4:58 PM
Sergio Zemskov
Sergio Zemskov - avatar
0
Well the value is 1.22×10^(-16) and its pretty close to zero actually. Even though it should return exactly zero, i dont know why it is returning a number tending to zero
2nd Aug 2016, 6:01 PM
Sumitabha Banerjee
Sumitabha Banerjee - avatar