C# Math.Cos(double) returns wrong value

c#

Solution

Math.Cos is expecting an angle in radians. I suspect your calculator is working in degrees.

You should be able to get the same answer by converting the value in degrees to radians:

double angleInDegrees = 32.471192290848492;
double cos = Math.Cos(angleInDegrees * (Math.PI / 180.0));

Problem

In C# I have this: ``` double Cos = Math.Cos(32.471192290848492); //Equals 0.49299653250335213 ``` But when I do this in a calculator I get this ``` (0.84366148773210745476752872050588) ``` Why is it returning the wrong value?

Original source

Related problems