Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

Jamie Wyton
Jamie Wyton
3,011 Points

Trigonometry in C#

Constructing a program using the Math. trigonometry functions, I was testing it and the results are different to using the scientific calculator, why is this or have I done something wrong?

Console.WriteLine(Math.Sin(35));

-0.428182669496151

Calc: sin(35)

0.57357643635104609610803191282616

1 Answer

Christopher Debove
PLUS
Christopher Debove
Courses Plus Student 18,373 Points

Hello I don't know for your calculator, but for Math.Sin, the angle must be in radians. In your calculator I think it's calculated from a degree unit.

EDIT : It was the problem

0.57357643635104609610803191282616 = sin(35) when 35 are degree

-0.428182669496151 = sin(35) when 35 are radians