julian bechtold
julian bechtold

Reputation: 2251

Math.Sin() gives incorrect value

given the following code:

double sin = Math.Sin(59.0);
double sin2 = Math.Sin(31.0);

first result is 0.64.. second result is -0.4..

if I type the same numbers into my calculator:
sin(59) = 0.86..
sin(31) = 0.51..

what do I do wrong?

Upvotes: 3

Views: 875

Answers (1)

OmG
OmG

Reputation: 18838

The same as most programming languages, in S, Sin function gets input in Radian. So if you desire to get the sin of 59 degree, you should write Math.Sin(59.0 * 3.1416/180.0) (By 3.1416, I mean PI value).

Upvotes: 8

Related Questions