在编写程序语言的时候,arcsinx与arccosy的计算精度有区别吗?
如果有区别,请问二者的区别有哪些?
如果无区别,请问你喜欢用哪一种方法呢?
当然,纯粹从数学推导来说,二者的计算应该是一样的.
我是在计算球面距离的时候用到的:
我的方法:
theta=R*arccos(cos(lat1)*cos(lat2)*cos(lon1-lon2)+sin(lat1)*sin(lat2))
Google的方法:
theta=2*arcsin(Sqrt((sin((lat1-lat2)/2)**2)+cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2)**2)))
没有比较两种方法的异同.
请大家查查我的方法中是否存在某种缺陷!
不好意思,我的方法中多了一个半径.请忽略!