\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\lambda_2 \leq -3.9 \cdot 10^{-8} \lor \neg \left(\lambda_2 \leq 4 \cdot 10^{-20}\right):\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_1}\\
\end{array}
\]
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(+
lambda1
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
↓
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (or (<= lambda2 -3.9e-8) (not (<= lambda2 4e-20)))
(+
lambda1
(atan2
(* (cos phi2) (sin (- lambda2)))
(+ (cos phi1) (* (cos phi2) (cos lambda2)))))
(+
lambda1
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(+ (cos phi1) (* (cos phi2) (cos lambda1)))))))double code(double lambda1, double lambda2, double phi1, double phi2) {
return lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
}
↓
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda2 <= -3.9e-8) || !(lambda2 <= 4e-20)) {
tmp = lambda1 + atan2((cos(phi2) * sin(-lambda2)), (cos(phi1) + (cos(phi2) * cos(lambda2))));
} else {
tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos(lambda1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
end function
↓
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if ((lambda2 <= (-3.9d-8)) .or. (.not. (lambda2 <= 4d-20))) then
tmp = lambda1 + atan2((cos(phi2) * sin(-lambda2)), (cos(phi1) + (cos(phi2) * cos(lambda2))))
else
tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos(lambda1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
}
↓
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda2 <= -3.9e-8) || !(lambda2 <= 4e-20)) {
tmp = lambda1 + Math.atan2((Math.cos(phi2) * Math.sin(-lambda2)), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos(lambda2))));
} else {
tmp = lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos(lambda1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
return lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
↓
def code(lambda1, lambda2, phi1, phi2):
tmp = 0
if (lambda2 <= -3.9e-8) or not (lambda2 <= 4e-20):
tmp = lambda1 + math.atan2((math.cos(phi2) * math.sin(-lambda2)), (math.cos(phi1) + (math.cos(phi2) * math.cos(lambda2))))
else:
tmp = lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(phi2) * math.cos(lambda1))))
return tmp
function code(lambda1, lambda2, phi1, phi2)
return Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
end
↓
function code(lambda1, lambda2, phi1, phi2)
tmp = 0.0
if ((lambda2 <= -3.9e-8) || !(lambda2 <= 4e-20))
tmp = Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(lambda2)))));
else
tmp = Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(lambda1)))));
end
return tmp
end
function tmp = code(lambda1, lambda2, phi1, phi2)
tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
end
↓
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
tmp = 0.0;
if ((lambda2 <= -3.9e-8) || ~((lambda2 <= 4e-20)))
tmp = lambda1 + atan2((cos(phi2) * sin(-lambda2)), (cos(phi1) + (cos(phi2) * cos(lambda2))));
else
tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos(lambda1))));
end
tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[lambda1_, lambda2_, phi1_, phi2_] := If[Or[LessEqual[lambda2, -3.9e-8], N[Not[LessEqual[lambda2, 4e-20]], $MachinePrecision]], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
↓
\begin{array}{l}
\mathbf{if}\;\lambda_2 \leq -3.9 \cdot 10^{-8} \lor \neg \left(\lambda_2 \leq 4 \cdot 10^{-20}\right):\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_1}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 13.4 |
|---|
| Cost | 52492 |
|---|
\[\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 + \cos \phi_1}\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq -0.938:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\cos \phi_1 \leq -0.004:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + t_2}\\
\mathbf{elif}\;\cos \phi_1 \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 \cdot t_2 + 1}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 13.4 |
|---|
| Cost | 52364 |
|---|
\[\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 + \cos \phi_1}\\
\mathbf{if}\;\cos \phi_1 \leq -0.938:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\cos \phi_1 \leq -0.42:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \lambda_2}\\
\mathbf{elif}\;\cos \phi_1 \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 \cdot \cos \lambda_2 + 1}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 13.4 |
|---|
| Cost | 52364 |
|---|
\[\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 + \cos \phi_1}\\
\mathbf{if}\;\cos \phi_1 \leq -0.938:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\cos \phi_1 \leq -0.004:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\cos \phi_1 \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 \cdot \cos \lambda_2 + 1}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.9 |
|---|
| Cost | 52096 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\lambda_1 - \lambda_2\right)\right)\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\]
| Alternative 5 |
|---|
| Error | 0.9 |
|---|
| Cost | 45568 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \left(\lambda_1 - \lambda_2\right), \cos \phi_2, \cos \phi_1\right)}
\]
| Alternative 6 |
|---|
| Error | 6.5 |
|---|
| Cost | 39812 |
|---|
\[\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq 0.986:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \left(-0.5 \cdot \left(\phi_2 \cdot \phi_2\right) + 1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 1.3 |
|---|
| Cost | 39369 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\lambda_2 \leq -5.2 \cdot 10^{-8} \lor \neg \left(\lambda_2 \leq 10^{-21}\right):\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 2.2 |
|---|
| Cost | 39300 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq 1.15 \cdot 10^{-52}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_1}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 0.9 |
|---|
| Cost | 39296 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\]
| Alternative 10 |
|---|
| Error | 12.3 |
|---|
| Cost | 39172 |
|---|
\[\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.58:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \left(\lambda_1 - \lambda_2\right) + \left(1 + -0.5 \cdot \left(\phi_1 \cdot \phi_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \lambda_2}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 7.3 |
|---|
| Cost | 39172 |
|---|
\[\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.99:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t_0}{\cos \phi_2 + \cos \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 12.3 |
|---|
| Cost | 33284 |
|---|
\[\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.58:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t_0}{\cos \left(\lambda_1 - \lambda_2\right) + \left(1 + -0.5 \cdot \left(\phi_1 \cdot \phi_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \lambda_2}\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 14.0 |
|---|
| Cost | 32772 |
|---|
\[\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.037:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t_0}{\cos \phi_1 + 1}\\
\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t_0}{\cos \phi_1 + \cos \lambda_2}\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 14.9 |
|---|
| Cost | 26112 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2}
\]
| Alternative 15 |
|---|
| Error | 20.9 |
|---|
| Cost | 19840 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{1 + \cos \left(\lambda_2 - \lambda_1\right)}
\]
| Alternative 16 |
|---|
| Error | 28.3 |
|---|
| Cost | 19712 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{1 + \cos \left(\lambda_2 - \lambda_1\right)}
\]
| Alternative 17 |
|---|
| Error | 24.2 |
|---|
| Cost | 19712 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_1 + 1}
\]
| Alternative 18 |
|---|
| Error | 21.0 |
|---|
| Cost | 19712 |
|---|
\[\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 + 1}
\]