Calculate tan-1 in angles c #?

2

I'm trying to do the following calculation but nothing works for me

The calculation of tan-1(1) the result of the calculator is 45 grados but I can not obtain this result in C #.

Code:

Math.Tanh(1);// resultado = 0,761594155955765
Math.Atan(1);//resultado = 0,785398163397448
Math.Tan(1);//1,5574077246549

I suppose I should perform some operation with one of them, but what operation and what to use to get the result.

    
asked by Shassain 12.10.2018 в 05:42
source

1 answer

2

You have to use Math.Atan (Double) .

According to the < strong> Microsoft documentation

  

Returns

     

Double

     

Angle, θ, measured in radians , as -π/2 ≤θ≤π/2 . Or NaN if% co_of% is   equal to NaN, d rounded to double precision (-1,5707963267949) if    -π/2 equals NegativeInfinity, or d rounded to double precision   (1,5707963267949) if π/2 equals

Considering this, it can be seen that the problem occurs because you are looking to obtain the degrees and the function is returning you radians.

To get the result in degrees you should do the following

Math.Atan(1) * 180 / Math.PI; // resultado 45
    
answered by 12.10.2018 / 06:00
source