Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

atan2 function behaves different in javascript and excellsheet

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 ?

like image 519
Hemant Metalia Avatar asked May 23 '12 10:05

Hemant Metalia


1 Answers

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.

like image 131
chucktator Avatar answered Oct 03 '22 06:10

chucktator