最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

excel - atan2 function behaves different in javascript and excellsheet - Stack Overflow

programmeradmin2浏览0评论

I am trying the atan2 Math Function but i am getting wrong value in google excel sheet. but getting correct value in javascript atan2 function. How can i get that value in excelsheet ?

my value in excel is

atan2(8.6,2.7699)=0.3115

while in javascript is

atan2(8.6,2.7699)=1.259206466337312

I have checked javascript value here .html

can any one say why this happens ?

if i want this value in excel then what formula should i use ?

I am trying the atan2 Math Function but i am getting wrong value in google excel sheet. but getting correct value in javascript atan2 function. How can i get that value in excelsheet ?

my value in excel is

atan2(8.6,2.7699)=0.3115

while in javascript is

atan2(8.6,2.7699)=1.259206466337312

I have checked javascript value here http://www.univie.ac.at/moe/rechner/rechner.html

can any one say why this happens ?

if i want this value in excel then what formula should i use ?

Share Improve this question asked May 23, 2012 at 10:25 Hemant MetaliaHemant Metalia 30.6k18 gold badges75 silver badges93 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 17

In Microsoft Excel the atan2 function takes the parameters in reverse order and Google Docs does the same thing for consistency. If you flip the parameters in javascript you get the same "wrong" value.

The function signature for atan2 in Excel is ATAN2(x_num, y_num) while in Javascript it's Math.atan2(y,x). Note the order of arguments.

They should both give your roughly the same answer if you provide the arguments in the appropriate order.

Excel's ATAN2 requires the x-coordinate followed by the y coordinate ATAN2(x,y) but JavaScript ATAN2 has the arguments reversed : ATAN2(y,x)

发布评论

评论列表(0)

  1. 暂无评论