\[\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot R
\]
↓
\[\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \cos \phi_1 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right)\right) \cdot R
\]
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(*
(acos
(+
(* (sin phi1) (sin phi2))
(* (* (cos phi1) (cos phi2)) (cos (- lambda1 lambda2)))))
R))↓
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(*
(acos
(+
(* (sin phi1) (sin phi2))
(* (cos phi1) (* (cos (- lambda1 lambda2)) (cos phi2)))))
R))double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return acos(((sin(phi1) * sin(phi2)) + ((cos(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))) * R;
}
↓
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return acos(((sin(phi1) * sin(phi2)) + (cos(phi1) * (cos((lambda1 - lambda2)) * cos(phi2))))) * R;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = acos(((sin(phi1) * sin(phi2)) + ((cos(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))) * r
end function
↓
real(8) function code(r, lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = acos(((sin(phi1) * sin(phi2)) + (cos(phi1) * (cos((lambda1 - lambda2)) * cos(phi2))))) * r
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return Math.acos(((Math.sin(phi1) * Math.sin(phi2)) + ((Math.cos(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2))))) * R;
}
↓
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return Math.acos(((Math.sin(phi1) * Math.sin(phi2)) + (Math.cos(phi1) * (Math.cos((lambda1 - lambda2)) * Math.cos(phi2))))) * R;
}
def code(R, lambda1, lambda2, phi1, phi2):
return math.acos(((math.sin(phi1) * math.sin(phi2)) + ((math.cos(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2))))) * R
↓
def code(R, lambda1, lambda2, phi1, phi2):
return math.acos(((math.sin(phi1) * math.sin(phi2)) + (math.cos(phi1) * (math.cos((lambda1 - lambda2)) * math.cos(phi2))))) * R
function code(R, lambda1, lambda2, phi1, phi2)
return Float64(acos(Float64(Float64(sin(phi1) * sin(phi2)) + Float64(Float64(cos(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) * R)
end
↓
function code(R, lambda1, lambda2, phi1, phi2)
return Float64(acos(Float64(Float64(sin(phi1) * sin(phi2)) + Float64(cos(phi1) * Float64(cos(Float64(lambda1 - lambda2)) * cos(phi2))))) * R)
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
tmp = acos(((sin(phi1) * sin(phi2)) + ((cos(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))) * R;
end
↓
function tmp = code(R, lambda1, lambda2, phi1, phi2)
tmp = acos(((sin(phi1) * sin(phi2)) + (cos(phi1) * (cos((lambda1 - lambda2)) * cos(phi2))))) * R;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(N[ArcCos[N[(N[(N[Sin[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * R), $MachinePrecision]
↓
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(N[ArcCos[N[(N[(N[Sin[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * R), $MachinePrecision]
\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot R
↓
\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \cos \phi_1 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right)\right) \cdot R
Alternatives
| Alternative 1 |
|---|
| Error | 16.9 |
|---|
| Cost | 39432 |
|---|
\[\begin{array}{l}
t_0 := \sin \phi_1 \cdot \sin \phi_2\\
t_1 := \cos^{-1} \left(t_0 + \cos \phi_1 \cdot \left(\cos \left(-\lambda_2\right) \cdot \cos \phi_2\right)\right) \cdot R\\
\mathbf{if}\;\lambda_2 \leq -5 \cdot 10^{-6}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\lambda_2 \leq 2.8 \cdot 10^{-18}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \left(\cos \phi_1 \cdot \cos \lambda_1\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 23.5 |
|---|
| Cost | 39368 |
|---|
\[\begin{array}{l}
t_0 := \sin \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_2 \leq -0.007:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{elif}\;\lambda_2 \leq 0.00041:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \left(\cos \phi_1 \cdot \cos \lambda_1\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(\sin \phi_1 \cdot \phi_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 16.6 |
|---|
| Cost | 39232 |
|---|
\[\cos^{-1} \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_1\right) + \sin \phi_1 \cdot \sin \phi_2\right) \cdot R
\]
| Alternative 4 |
|---|
| Error | 30.0 |
|---|
| Cost | 33096 |
|---|
\[\begin{array}{l}
t_0 := \sin \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_1 \leq -1.35 \cdot 10^{+130}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 145:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \cos \phi_1\right) \cdot R\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 29.1 |
|---|
| Cost | 33096 |
|---|
\[\begin{array}{l}
t_0 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -200000:\\
\;\;\;\;\cos^{-1} \left(\sin \phi_1 \cdot \phi_2 + t_0\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 1950000:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + t_0\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \cos \phi_2 \cdot \cos \phi_1\right) \cdot R\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 29.7 |
|---|
| Cost | 32972 |
|---|
\[\begin{array}{l}
t_0 := \sin \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_1 \leq -1.4 \cdot 10^{+222}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq -0.35:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 0.00092:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \cos \phi_1\right) \cdot R\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 29.5 |
|---|
| Cost | 32840 |
|---|
\[\begin{array}{l}
t_0 := \sin \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_1 \leq -0.00165:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 0.014:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \cos \phi_1\right) \cdot R\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 35.4 |
|---|
| Cost | 32708 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\phi_1 \leq -0.0024:\\
\;\;\;\;\cos^{-1} \left(\sin \phi_1 \cdot \sin \phi_2 + \cos \phi_1 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right) \cdot R\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 39.9 |
|---|
| Cost | 26572 |
|---|
\[\begin{array}{l}
t_0 := \phi_1 \cdot \sin \phi_2\\
t_1 := \cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{if}\;\lambda_2 \leq -1.15 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\lambda_2 \leq 2.3 \cdot 10^{-250}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_2 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{elif}\;\lambda_2 \leq 5.2 \cdot 10^{-12}:\\
\;\;\;\;\cos^{-1} \left(t_0 + \cos \phi_1 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 37.9 |
|---|
| Cost | 26568 |
|---|
\[\begin{array}{l}
t_0 := \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -1.25 \cdot 10^{+221}:\\
\;\;\;\;\cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq -0.0014:\\
\;\;\;\;\cos^{-1} \left(t_0 + t_1 \cdot \cos \phi_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(t_0 + t_1 \cdot \cos \phi_2\right) \cdot R\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 42.7 |
|---|
| Cost | 26440 |
|---|
\[\begin{array}{l}
t_0 := \cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{if}\;\phi_1 \leq -2.75 \cdot 10^{+219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\phi_1 \leq -1.95 \cdot 10^{-25}:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \phi_1 \cdot \cos \lambda_1\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 2.45 \cdot 10^{-219}:\\
\;\;\;\;\cos^{-1} \left(\phi_2 \cdot \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 40.9 |
|---|
| Cost | 26436 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 3.5 \cdot 10^{-6}:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 43.3 |
|---|
| Cost | 20300 |
|---|
\[\begin{array}{l}
t_0 := \cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{+218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\phi_1 \leq -270000:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \phi_1\right) \cdot R\\
\mathbf{elif}\;\phi_1 \leq 1.3 \cdot 10^{-219}:\\
\;\;\;\;\cos^{-1} \left(\phi_2 \cdot \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 44.2 |
|---|
| Cost | 19912 |
|---|
\[\begin{array}{l}
t_0 := \cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{+218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\phi_1 \leq -25000:\\
\;\;\;\;\cos^{-1} \left(\phi_1 \cdot \sin \phi_2 + \cos \phi_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 44.0 |
|---|
| Cost | 19584 |
|---|
\[\cos^{-1} \left(\cos \phi_2 \cdot \cos \left(-\lambda_2\right)\right) \cdot R
\]
| Alternative 16 |
|---|
| Error | 52.6 |
|---|
| Cost | 13056 |
|---|
\[\cos^{-1} \cos \left(-\lambda_2\right) \cdot R
\]
| Alternative 17 |
|---|
| Error | 60.9 |
|---|
| Cost | 256 |
|---|
\[\left(-\lambda_2\right) \cdot R
\]