javascript Math.atan(Math.tan())没用?

Mas*_*imo 3 javascript math

在Windows 7上,查看该文件

C:\ WINDOWS\winsxs文件...\weather.js

有一个功能computeSunRiseSunSet(Latitude, Longitude, TimeZone, Year, Month, Day).

他们没有引用算法的来源.

一行代码是

var C2=RD*(Math.atan(Math.tan(L0+C)) - Math.atan(.9175*Math.tan(L0+C))-C);
Run Code Online (Sandbox Code Playgroud)

为什么有Math.atan(Math.tan(L0 + C))?

它与(L0 + C)相同还是有角落情况?

Jon*_*oni 8

atan(tan(x)) 是一个周期性的"锯齿"功能:

for -pi/2 < x < pi/2,   atan(tan(x)) = x
for  pi/2 < x < 3pi/2,  atan(tan(x)) = x - pi
for 3pi/2 < x < 5pi/2,  atan(tan(x)) = x - 2pi
...
Run Code Online (Sandbox Code Playgroud)

您可以在Wolfram Alpha上绘制并查看有关它的其他详细信息.