How do i use inversed tan in javascript? - Stack Overflow

I need to calculate an angle of a triangle by using the tan^-1 function. On my calculator I can do this

I need to calculate an angle of a triangle by using the tan^-1 function. On my calculator I can do this:

tan^-1(3/4) // 3 and 4 are triangle side lengths

And it outputs 36 degrees. What is the alternative to this function in JavaScript? I tried Math.tan(3/4), Math.atan(3/4) and all of the other tan functions I saw in the list, but none of them outputs the result in degrees I need (36). Thank you.

I need to calculate an angle of a triangle by using the tan^-1 function. On my calculator I can do this:

tan^-1(3/4) // 3 and 4 are triangle side lengths

And it outputs 36 degrees. What is the alternative to this function in JavaScript? I tried Math.tan(3/4), Math.atan(3/4) and all of the other tan functions I saw in the list, but none of them outputs the result in degrees I need (36). Thank you.

Share Improve this question edited Sep 29, 2015 at 12:20 Wolf 10.3k8 gold badges68 silver badges112 bronze badges asked Sep 29, 2015 at 11:50 AskermanAskerman 8471 gold badge14 silver badges31 bronze badges 2
  • 2 javascript works in radians – Jaromanda X Commented Sep 29, 2015 at 11:51
  • By the way it should be 36.8698976, not 36. Math.atan(3/4) * 180 / Math.PI – Jaromanda X Commented Sep 29, 2015 at 11:54
Add a ment  | 

1 Answer 1

Reset to default 8

There is no build in function for that, since 1 radian = 180/pi degrees you can do the following using Math.atan() and Math.PI

var degree = Math.atan(3 / 4) * (180 / Math.PI);

document.write(degree);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745417697a4626824.html

相关推荐

  • How do i use inversed tan in javascript? - Stack Overflow

    I need to calculate an angle of a triangle by using the tan^-1 function. On my calculator I can do this

    10小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信