
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1
(+
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
(* (* (* (cos phi1) (cos phi2)) t_0) t_0))))
(* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0)
code = r * (2.0d0 * atan2(sqrt(t_1), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * t_0) * t_0);
return R * (2.0 * Math.atan2(Math.sqrt(t_1), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0) return R * (2.0 * math.atan2(math.sqrt(t_1), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0)) return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = (sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0); tmp = R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) \cdot t_0\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1}}{\sqrt{1 - t_1}}\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1
(+
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
(* (* (* (cos phi1) (cos phi2)) t_0) t_0))))
(* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0)
code = r * (2.0d0 * atan2(sqrt(t_1), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * t_0) * t_0);
return R * (2.0 * Math.atan2(Math.sqrt(t_1), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0) return R * (2.0 * math.atan2(math.sqrt(t_1), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0)) return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = (sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0); tmp = R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) \cdot t_0\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1}}{\sqrt{1 - t_1}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (cos phi2)))
(t_1 (cos (* 0.5 phi2)))
(t_2 (sin (* 0.5 phi2)))
(t_3 (cos (* 0.5 phi1)))
(t_4 (sin (/ (- lambda1 lambda2) 2.0)))
(t_5 (sin (* 0.5 phi1))))
(*
R
(*
2.0
(atan2
(sqrt (+ (pow (fma t_5 t_1 (* t_2 (- t_3))) 2.0) (* t_4 (* t_0 t_4))))
(sqrt
(-
(- 1.0 (pow (- (* t_1 t_5) (* t_2 t_3)) 2.0))
(* t_0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * cos(phi2);
double t_1 = cos((0.5 * phi2));
double t_2 = sin((0.5 * phi2));
double t_3 = cos((0.5 * phi1));
double t_4 = sin(((lambda1 - lambda2) / 2.0));
double t_5 = sin((0.5 * phi1));
return R * (2.0 * atan2(sqrt((pow(fma(t_5, t_1, (t_2 * -t_3)), 2.0) + (t_4 * (t_0 * t_4)))), sqrt(((1.0 - pow(((t_1 * t_5) - (t_2 * t_3)), 2.0)) - (t_0 * pow(sin((0.5 * (lambda1 - lambda2))), 2.0))))));
}
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * cos(phi2)) t_1 = cos(Float64(0.5 * phi2)) t_2 = sin(Float64(0.5 * phi2)) t_3 = cos(Float64(0.5 * phi1)) t_4 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_5 = sin(Float64(0.5 * phi1)) return Float64(R * Float64(2.0 * atan(sqrt(Float64((fma(t_5, t_1, Float64(t_2 * Float64(-t_3))) ^ 2.0) + Float64(t_4 * Float64(t_0 * t_4)))), sqrt(Float64(Float64(1.0 - (Float64(Float64(t_1 * t_5) - Float64(t_2 * t_3)) ^ 2.0)) - Float64(t_0 * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0))))))) end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[(t$95$5 * t$95$1 + N[(t$95$2 * (-t$95$3)), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$4 * N[(t$95$0 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Power[N[(N[(t$95$1 * t$95$5), $MachinePrecision] - N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \cos \left(0.5 \cdot \phi_2\right)\\
t_2 := \sin \left(0.5 \cdot \phi_2\right)\\
t_3 := \cos \left(0.5 \cdot \phi_1\right)\\
t_4 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_5 := \sin \left(0.5 \cdot \phi_1\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(t_5, t_1, t_2 \cdot \left(-t_3\right)\right)\right)}^{2} + t_4 \cdot \left(t_0 \cdot t_4\right)}}{\sqrt{\left(1 - {\left(t_1 \cdot t_5 - t_2 \cdot t_3\right)}^{2}\right) - t_0 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1
(+
(* t_0 (* (* (cos phi1) (cos phi2)) t_0))
(pow
(-
(* (cos (* 0.5 phi2)) (sin (* 0.5 phi1)))
(* (sin (* 0.5 phi2)) (cos (* 0.5 phi1))))
2.0))))
(* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = (t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = (t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (((cos((0.5d0 * phi2)) * sin((0.5d0 * phi1))) - (sin((0.5d0 * phi2)) * cos((0.5d0 * phi1)))) ** 2.0d0)
code = r * (2.0d0 * atan2(sqrt(t_1), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = (t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + Math.pow(((Math.cos((0.5 * phi2)) * Math.sin((0.5 * phi1))) - (Math.sin((0.5 * phi2)) * Math.cos((0.5 * phi1)))), 2.0);
return R * (2.0 * Math.atan2(Math.sqrt(t_1), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = (t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + math.pow(((math.cos((0.5 * phi2)) * math.sin((0.5 * phi1))) - (math.sin((0.5 * phi2)) * math.cos((0.5 * phi1)))), 2.0) return R * (2.0 * math.atan2(math.sqrt(t_1), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (Float64(Float64(cos(Float64(0.5 * phi2)) * sin(Float64(0.5 * phi1))) - Float64(sin(Float64(0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0)) return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = (t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))) ^ 2.0); tmp = R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) + {\left(\cos \left(0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) - \sin \left(0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1}}{\sqrt{1 - t_1}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1
(pow
(-
(* (cos (* 0.5 phi2)) (sin (* 0.5 phi1)))
(* (sin (* 0.5 phi2)) (cos (* 0.5 phi1))))
2.0))
(t_2 (sqrt (- 1.0 (+ (* t_0 (* (* (cos phi1) (cos phi2)) t_0)) t_1)))))
(if (or (<= lambda1 -4.4e-19) (not (<= lambda1 6.8e-10)))
(*
R
(*
2.0
(atan2
(sqrt
(+ (* (cos phi1) (* (cos phi2) (pow (sin (* 0.5 lambda1)) 2.0))) t_1))
t_2)))
(*
R
(*
2.0
(atan2
(sqrt
(+
t_1
(* (cos phi1) (* (cos phi2) (pow (sin (* lambda2 -0.5)) 2.0)))))
t_2))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = pow(((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
double t_2 = sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + t_1)));
double tmp;
if ((lambda1 <= -4.4e-19) || !(lambda1 <= 6.8e-10)) {
tmp = R * (2.0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * pow(sin((0.5 * lambda1)), 2.0))) + t_1)), t_2));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + (cos(phi1) * (cos(phi2) * pow(sin((lambda2 * -0.5)), 2.0))))), t_2));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = ((cos((0.5d0 * phi2)) * sin((0.5d0 * phi1))) - (sin((0.5d0 * phi2)) * cos((0.5d0 * phi1)))) ** 2.0d0
t_2 = sqrt((1.0d0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + t_1)))
if ((lambda1 <= (-4.4d-19)) .or. (.not. (lambda1 <= 6.8d-10))) then
tmp = r * (2.0d0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * (sin((0.5d0 * lambda1)) ** 2.0d0))) + t_1)), t_2))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (cos(phi1) * (cos(phi2) * (sin((lambda2 * (-0.5d0))) ** 2.0d0))))), t_2))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = Math.pow(((Math.cos((0.5 * phi2)) * Math.sin((0.5 * phi1))) - (Math.sin((0.5 * phi2)) * Math.cos((0.5 * phi1)))), 2.0);
double t_2 = Math.sqrt((1.0 - ((t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + t_1)));
double tmp;
if ((lambda1 <= -4.4e-19) || !(lambda1 <= 6.8e-10)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((0.5 * lambda1)), 2.0))) + t_1)), t_2));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + (Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((lambda2 * -0.5)), 2.0))))), t_2));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = math.pow(((math.cos((0.5 * phi2)) * math.sin((0.5 * phi1))) - (math.sin((0.5 * phi2)) * math.cos((0.5 * phi1)))), 2.0) t_2 = math.sqrt((1.0 - ((t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + t_1))) tmp = 0 if (lambda1 <= -4.4e-19) or not (lambda1 <= 6.8e-10): tmp = R * (2.0 * math.atan2(math.sqrt(((math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((0.5 * lambda1)), 2.0))) + t_1)), t_2)) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + (math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((lambda2 * -0.5)), 2.0))))), t_2)) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(Float64(cos(Float64(0.5 * phi2)) * sin(Float64(0.5 * phi1))) - Float64(sin(Float64(0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0 t_2 = sqrt(Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + t_1))) tmp = 0.0 if ((lambda1 <= -4.4e-19) || !(lambda1 <= 6.8e-10)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(0.5 * lambda1)) ^ 2.0))) + t_1)), t_2))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(lambda2 * -0.5)) ^ 2.0))))), t_2))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = ((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))) ^ 2.0; t_2 = sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + t_1))); tmp = 0.0; if ((lambda1 <= -4.4e-19) || ~((lambda1 <= 6.8e-10))) tmp = R * (2.0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * (sin((0.5 * lambda1)) ^ 2.0))) + t_1)), t_2)); else tmp = R * (2.0 * atan2(sqrt((t_1 + (cos(phi1) * (cos(phi2) * (sin((lambda2 * -0.5)) ^ 2.0))))), t_2)); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 - N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[lambda1, -4.4e-19], N[Not[LessEqual[lambda1, 6.8e-10]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] / t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(lambda2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\left(\cos \left(0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) - \sin \left(0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\\
t_2 := \sqrt{1 - \left(t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) + t_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -4.4 \cdot 10^{-19} \lor \neg \left(\lambda_1 \leq 6.8 \cdot 10^{-10}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \lambda_1\right)}^{2}\right) + t_1}}{t_2}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}\right)}}{t_2}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (* 0.5 phi2)))
(t_1 (cos (* 0.5 phi1)))
(t_2 (* (cos phi1) (cos phi2)))
(t_3 (sin (/ (- lambda1 lambda2) 2.0)))
(t_4 (* t_3 (* t_2 t_3)))
(t_5 (sin (* 0.5 phi1)))
(t_6 (cos (* 0.5 phi2)))
(t_7 (pow (- (* t_6 t_5) (* t_0 t_1)) 2.0))
(t_8 (+ t_4 t_7))
(t_9 (sin (* 0.5 lambda1))))
(if (<= lambda1 -1.55e-21)
(*
R
(*
2.0
(atan2
(sqrt t_8)
(sqrt (- 1.0 (+ t_4 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))))))
(if (<= lambda1 14.0)
(*
R
(*
2.0
(atan2
(sqrt
(+
t_7
(* (cos phi1) (* (cos phi2) (pow (sin (* lambda2 -0.5)) 2.0)))))
(sqrt (- 1.0 t_8)))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_4 (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))
(sqrt
(-
1.0
(+
(pow (fma t_5 t_6 (* t_0 (- t_1))) 2.0)
(* t_9 (* t_2 t_9))))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * phi2));
double t_1 = cos((0.5 * phi1));
double t_2 = cos(phi1) * cos(phi2);
double t_3 = sin(((lambda1 - lambda2) / 2.0));
double t_4 = t_3 * (t_2 * t_3);
double t_5 = sin((0.5 * phi1));
double t_6 = cos((0.5 * phi2));
double t_7 = pow(((t_6 * t_5) - (t_0 * t_1)), 2.0);
double t_8 = t_4 + t_7;
double t_9 = sin((0.5 * lambda1));
double tmp;
if (lambda1 <= -1.55e-21) {
tmp = R * (2.0 * atan2(sqrt(t_8), sqrt((1.0 - (t_4 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))))));
} else if (lambda1 <= 14.0) {
tmp = R * (2.0 * atan2(sqrt((t_7 + (cos(phi1) * (cos(phi2) * pow(sin((lambda2 * -0.5)), 2.0))))), sqrt((1.0 - t_8))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_4 + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - (pow(fma(t_5, t_6, (t_0 * -t_1)), 2.0) + (t_9 * (t_2 * t_9)))))));
}
return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * phi2)) t_1 = cos(Float64(0.5 * phi1)) t_2 = Float64(cos(phi1) * cos(phi2)) t_3 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_4 = Float64(t_3 * Float64(t_2 * t_3)) t_5 = sin(Float64(0.5 * phi1)) t_6 = cos(Float64(0.5 * phi2)) t_7 = Float64(Float64(t_6 * t_5) - Float64(t_0 * t_1)) ^ 2.0 t_8 = Float64(t_4 + t_7) t_9 = sin(Float64(0.5 * lambda1)) tmp = 0.0 if (lambda1 <= -1.55e-21) tmp = Float64(R * Float64(2.0 * atan(sqrt(t_8), sqrt(Float64(1.0 - Float64(t_4 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))))))); elseif (lambda1 <= 14.0) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_7 + Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(lambda2 * -0.5)) ^ 2.0))))), sqrt(Float64(1.0 - t_8))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_4 + Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))), sqrt(Float64(1.0 - Float64((fma(t_5, t_6, Float64(t_0 * Float64(-t_1))) ^ 2.0) + Float64(t_9 * Float64(t_2 * t_9)))))))); end return tmp end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[Power[N[(N[(t$95$6 * t$95$5), $MachinePrecision] - N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$8 = N[(t$95$4 + t$95$7), $MachinePrecision]}, Block[{t$95$9 = N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -1.55e-21], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$8], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$4 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, 14.0], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$7 + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(lambda2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$8), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$4 + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(t$95$5 * t$95$6 + N[(t$95$0 * (-t$95$1)), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$9 * N[(t$95$2 * t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \phi_2\right)\\
t_1 := \cos \left(0.5 \cdot \phi_1\right)\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_4 := t_3 \cdot \left(t_2 \cdot t_3\right)\\
t_5 := \sin \left(0.5 \cdot \phi_1\right)\\
t_6 := \cos \left(0.5 \cdot \phi_2\right)\\
t_7 := {\left(t_6 \cdot t_5 - t_0 \cdot t_1\right)}^{2}\\
t_8 := t_4 + t_7\\
t_9 := \sin \left(0.5 \cdot \lambda_1\right)\\
\mathbf{if}\;\lambda_1 \leq -1.55 \cdot 10^{-21}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_8}}{\sqrt{1 - \left(t_4 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\
\mathbf{elif}\;\lambda_1 \leq 14:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_7 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}\right)}}{\sqrt{1 - t_8}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_4 + \left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t_5, t_6, t_0 \cdot \left(-t_1\right)\right)\right)}^{2} + t_9 \cdot \left(t_2 \cdot t_9\right)\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt
(-
1.0
(+
t_1
(pow
(-
(* (cos (* 0.5 phi2)) (sin (* 0.5 phi1)))
(* (sin (* 0.5 phi2)) (cos (* 0.5 phi1))))
2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
return R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - (t_1 + pow(((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))), 2.0))))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
code = r * (2.0d0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - (t_1 + (((cos((0.5d0 * phi2)) * sin((0.5d0 * phi1))) - (sin((0.5d0 * phi2)) * cos((0.5d0 * phi1)))) ** 2.0d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
return R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - (t_1 + Math.pow(((Math.cos((0.5 * phi2)) * Math.sin((0.5 * phi1))) - (Math.sin((0.5 * phi2)) * Math.cos((0.5 * phi1)))), 2.0))))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) return R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - (t_1 + math.pow(((math.cos((0.5 * phi2)) * math.sin((0.5 * phi1))) - (math.sin((0.5 * phi2)) * math.cos((0.5 * phi1)))), 2.0))))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - Float64(t_1 + (Float64(Float64(cos(Float64(0.5 * phi2)) * sin(Float64(0.5 * phi1))) - Float64(sin(Float64(0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0))))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); tmp = R * (2.0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - (t_1 + (((cos((0.5 * phi2)) * sin((0.5 * phi1))) - (sin((0.5 * phi2)) * cos((0.5 * phi1)))) ^ 2.0)))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$1 + N[Power[N[(N[(N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - \left(t_1 + {\left(\cos \left(0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) - \sin \left(0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\right)}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0))))
(*
R
(*
2.0
(atan2
(sqrt
(+
(* t_0 (* (* (cos phi1) (cos phi2)) t_0))
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt
(fabs
(-
1.0
(fma
(cos phi1)
(* (cos phi2) (fma -0.5 (cos (- lambda1 lambda2)) 0.5))
(pow (sin (* -0.5 (- phi2 phi1))) 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
return R * (2.0 * atan2(sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt(fabs((1.0 - fma(cos(phi1), (cos(phi2) * fma(-0.5, cos((lambda1 - lambda2)), 0.5)), pow(sin((-0.5 * (phi2 - phi1))), 2.0)))))));
}
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(abs(Float64(1.0 - fma(cos(phi1), Float64(cos(phi2) * fma(-0.5, cos(Float64(lambda1 - lambda2)), 0.5)), (sin(Float64(-0.5 * Float64(phi2 - phi1))) ^ 2.0)))))))) end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Abs[N[(1.0 - N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(-0.5 * N[(phi2 - phi1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left|1 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \mathsf{fma}\left(-0.5, \cos \left(\lambda_1 - \lambda_2\right), 0.5\right), {\sin \left(-0.5 \cdot \left(\phi_2 - \phi_1\right)\right)}^{2}\right)\right|}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (cos phi2)))
(t_1 (sin (/ (- lambda1 lambda2) 2.0))))
(*
R
(*
2.0
(atan2
(sqrt (+ (* t_1 (* t_0 t_1)) (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt
(-
(- 1.0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0))
(* t_0 (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * cos(phi2);
double t_1 = sin(((lambda1 - lambda2) / 2.0));
return R * (2.0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt(((1.0 - pow(sin((0.5 * (phi1 - phi2))), 2.0)) - (t_0 * (0.5 + (-0.5 * cos((lambda1 - lambda2)))))))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = cos(phi1) * cos(phi2)
t_1 = sin(((lambda1 - lambda2) / 2.0d0))
code = r * (2.0d0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt(((1.0d0 - (sin((0.5d0 * (phi1 - phi2))) ** 2.0d0)) - (t_0 * (0.5d0 + ((-0.5d0) * cos((lambda1 - lambda2)))))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.cos(phi2);
double t_1 = Math.sin(((lambda1 - lambda2) / 2.0));
return R * (2.0 * Math.atan2(Math.sqrt(((t_1 * (t_0 * t_1)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt(((1.0 - Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0)) - (t_0 * (0.5 + (-0.5 * Math.cos((lambda1 - lambda2)))))))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.cos(phi2) t_1 = math.sin(((lambda1 - lambda2) / 2.0)) return R * (2.0 * math.atan2(math.sqrt(((t_1 * (t_0 * t_1)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt(((1.0 - math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0)) - (t_0 * (0.5 + (-0.5 * math.cos((lambda1 - lambda2)))))))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * cos(phi2)) t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * Float64(t_0 * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(Float64(1.0 - (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0)) - Float64(t_0 * Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))))))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * cos(phi2); t_1 = sin(((lambda1 - lambda2) / 2.0)); tmp = R * (2.0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(((1.0 - (sin((0.5 * (phi1 - phi2))) ^ 2.0)) - (t_0 * (0.5 + (-0.5 * cos((lambda1 - lambda2))))))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 \cdot \left(t_0 \cdot t_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left(1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right) - t_0 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0)))
(t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
(if (or (<= phi2 -0.00023) (not (<= phi2 1.8e-5)))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt (- 1.0 (+ (* (cos phi2) t_2) (pow (sin (* 0.5 phi2)) 2.0)))))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt
(- 1.0 (+ (pow (sin (* 0.5 phi1)) 2.0) (* (cos phi1) t_2))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if ((phi2 <= -0.00023) || !(phi2 <= 1.8e-5)) {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + pow(sin((0.5 * phi2)), 2.0))))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - (pow(sin((0.5 * phi1)), 2.0) + (cos(phi1) * t_2))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
if ((phi2 <= (-0.00023d0)) .or. (.not. (phi2 <= 1.8d-5))) then
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - ((cos(phi2) * t_2) + (sin((0.5d0 * phi2)) ** 2.0d0))))))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - ((sin((0.5d0 * phi1)) ** 2.0d0) + (cos(phi1) * t_2))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if ((phi2 <= -0.00023) || !(phi2 <= 1.8e-5)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - ((Math.cos(phi2) * t_2) + Math.pow(Math.sin((0.5 * phi2)), 2.0))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - (Math.pow(Math.sin((0.5 * phi1)), 2.0) + (Math.cos(phi1) * t_2))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) tmp = 0 if (phi2 <= -0.00023) or not (phi2 <= 1.8e-5): tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - ((math.cos(phi2) * t_2) + math.pow(math.sin((0.5 * phi2)), 2.0)))))) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - (math.pow(math.sin((0.5 * phi1)), 2.0) + (math.cos(phi1) * t_2)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 tmp = 0.0 if ((phi2 <= -0.00023) || !(phi2 <= 1.8e-5)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - Float64(Float64(cos(phi2) * t_2) + (sin(Float64(0.5 * phi2)) ^ 2.0))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - Float64((sin(Float64(0.5 * phi1)) ^ 2.0) + Float64(cos(phi1) * t_2))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; tmp = 0.0; if ((phi2 <= -0.00023) || ~((phi2 <= 1.8e-5))) tmp = R * (2.0 * atan2(sqrt((t_1 + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + (sin((0.5 * phi2)) ^ 2.0)))))); else tmp = R * (2.0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - ((sin((0.5 * phi1)) ^ 2.0) + (cos(phi1) * t_2)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[phi2, -0.00023], N[Not[LessEqual[phi2, 1.8e-5]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
\mathbf{if}\;\phi_2 \leq -0.00023 \lor \neg \left(\phi_2 \leq 1.8 \cdot 10^{-5}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_2 \cdot t_2 + {\sin \left(0.5 \cdot \phi_2\right)}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot t_2\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0)))
(t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
(t_3 (pow (sin (* 0.5 phi1)) 2.0)))
(if (or (<= phi1 -9.5e-5) (not (<= phi1 0.000195)))
(*
R
(*
2.0
(atan2 (sqrt (+ t_1 t_3)) (sqrt (- 1.0 (+ t_3 (* (cos phi1) t_2)))))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt
(- 1.0 (+ (* (cos phi2) t_2) (pow (sin (* phi2 -0.5)) 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = pow(sin((0.5 * phi1)), 2.0);
double tmp;
if ((phi1 <= -9.5e-5) || !(phi1 <= 0.000195)) {
tmp = R * (2.0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0 - (t_3 + (cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + pow(sin((phi2 * -0.5)), 2.0))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
t_3 = sin((0.5d0 * phi1)) ** 2.0d0
if ((phi1 <= (-9.5d-5)) .or. (.not. (phi1 <= 0.000195d0))) then
tmp = r * (2.0d0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0d0 - (t_3 + (cos(phi1) * t_2))))))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - ((cos(phi2) * t_2) + (sin((phi2 * (-0.5d0))) ** 2.0d0))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = Math.pow(Math.sin((0.5 * phi1)), 2.0);
double tmp;
if ((phi1 <= -9.5e-5) || !(phi1 <= 0.000195)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + t_3)), Math.sqrt((1.0 - (t_3 + (Math.cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - ((Math.cos(phi2) * t_2) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) t_3 = math.pow(math.sin((0.5 * phi1)), 2.0) tmp = 0 if (phi1 <= -9.5e-5) or not (phi1 <= 0.000195): tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + t_3)), math.sqrt((1.0 - (t_3 + (math.cos(phi1) * t_2)))))) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - ((math.cos(phi2) * t_2) + math.pow(math.sin((phi2 * -0.5)), 2.0)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 t_3 = sin(Float64(0.5 * phi1)) ^ 2.0 tmp = 0.0 if ((phi1 <= -9.5e-5) || !(phi1 <= 0.000195)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + t_3)), sqrt(Float64(1.0 - Float64(t_3 + Float64(cos(phi1) * t_2))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - Float64(Float64(cos(phi2) * t_2) + (sin(Float64(phi2 * -0.5)) ^ 2.0))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; t_3 = sin((0.5 * phi1)) ^ 2.0; tmp = 0.0; if ((phi1 <= -9.5e-5) || ~((phi1 <= 0.000195))) tmp = R * (2.0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0 - (t_3 + (cos(phi1) * t_2)))))); else tmp = R * (2.0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + (sin((phi2 * -0.5)) ^ 2.0)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[phi1, -9.5e-5], N[Not[LessEqual[phi1, 0.000195]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + t$95$3), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$3 + N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
t_3 := {\sin \left(0.5 \cdot \phi_1\right)}^{2}\\
\mathbf{if}\;\phi_1 \leq -9.5 \cdot 10^{-5} \lor \neg \left(\phi_1 \leq 0.000195\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + t_3}}{\sqrt{1 - \left(t_3 + \cos \phi_1 \cdot t_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_2 \cdot t_2 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0)))
(t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
(if (or (<= phi1 -5.4e-6) (not (<= phi1 8.4e-7)))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))
(sqrt (- 1.0 (+ (pow (sin (* 0.5 phi1)) 2.0) (* (cos phi1) t_2)))))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt
(- 1.0 (+ (* (cos phi2) t_2) (pow (sin (* 0.5 phi2)) 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if ((phi1 <= -5.4e-6) || !(phi1 <= 8.4e-7)) {
tmp = R * (2.0 * atan2(sqrt((t_1 + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - (pow(sin((0.5 * phi1)), 2.0) + (cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + pow(sin((0.5 * phi2)), 2.0))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
if ((phi1 <= (-5.4d-6)) .or. (.not. (phi1 <= 8.4d-7))) then
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (0.5d0 - (cos((phi1 - phi2)) / 2.0d0)))), sqrt((1.0d0 - ((sin((0.5d0 * phi1)) ** 2.0d0) + (cos(phi1) * t_2))))))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - ((cos(phi2) * t_2) + (sin((0.5d0 * phi2)) ** 2.0d0))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if ((phi1 <= -5.4e-6) || !(phi1 <= 8.4e-7)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + (0.5 - (Math.cos((phi1 - phi2)) / 2.0)))), Math.sqrt((1.0 - (Math.pow(Math.sin((0.5 * phi1)), 2.0) + (Math.cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - ((Math.cos(phi2) * t_2) + Math.pow(Math.sin((0.5 * phi2)), 2.0))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) tmp = 0 if (phi1 <= -5.4e-6) or not (phi1 <= 8.4e-7): tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + (0.5 - (math.cos((phi1 - phi2)) / 2.0)))), math.sqrt((1.0 - (math.pow(math.sin((0.5 * phi1)), 2.0) + (math.cos(phi1) * t_2)))))) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - ((math.cos(phi2) * t_2) + math.pow(math.sin((0.5 * phi2)), 2.0)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 tmp = 0.0 if ((phi1 <= -5.4e-6) || !(phi1 <= 8.4e-7)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))), sqrt(Float64(1.0 - Float64((sin(Float64(0.5 * phi1)) ^ 2.0) + Float64(cos(phi1) * t_2))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - Float64(Float64(cos(phi2) * t_2) + (sin(Float64(0.5 * phi2)) ^ 2.0))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; tmp = 0.0; if ((phi1 <= -5.4e-6) || ~((phi1 <= 8.4e-7))) tmp = R * (2.0 * atan2(sqrt((t_1 + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - ((sin((0.5 * phi1)) ^ 2.0) + (cos(phi1) * t_2)))))); else tmp = R * (2.0 * atan2(sqrt((t_1 + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + (sin((0.5 * phi2)) ^ 2.0)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[phi1, -5.4e-6], N[Not[LessEqual[phi1, 8.4e-7]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
\mathbf{if}\;\phi_1 \leq -5.4 \cdot 10^{-6} \lor \neg \left(\phi_1 \leq 8.4 \cdot 10^{-7}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + \left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot t_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_2 \cdot t_2 + {\sin \left(0.5 \cdot \phi_2\right)}^{2}\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0)))
(t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
(t_3 (pow (sin (* 0.5 phi1)) 2.0)))
(if (or (<= phi1 -4.6e-8) (not (<= phi1 0.000108)))
(*
R
(*
2.0
(atan2 (sqrt (+ t_1 t_3)) (sqrt (- 1.0 (+ t_3 (* (cos phi1) t_2)))))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt
(- 1.0 (+ (* (cos phi2) t_2) (pow (sin (* 0.5 phi2)) 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = pow(sin((0.5 * phi1)), 2.0);
double tmp;
if ((phi1 <= -4.6e-8) || !(phi1 <= 0.000108)) {
tmp = R * (2.0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0 - (t_3 + (cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + pow(sin((0.5 * phi2)), 2.0))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
t_3 = sin((0.5d0 * phi1)) ** 2.0d0
if ((phi1 <= (-4.6d-8)) .or. (.not. (phi1 <= 0.000108d0))) then
tmp = r * (2.0d0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0d0 - (t_3 + (cos(phi1) * t_2))))))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - ((cos(phi2) * t_2) + (sin((0.5d0 * phi2)) ** 2.0d0))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = Math.pow(Math.sin((0.5 * phi1)), 2.0);
double tmp;
if ((phi1 <= -4.6e-8) || !(phi1 <= 0.000108)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + t_3)), Math.sqrt((1.0 - (t_3 + (Math.cos(phi1) * t_2))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - ((Math.cos(phi2) * t_2) + Math.pow(Math.sin((0.5 * phi2)), 2.0))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) t_3 = math.pow(math.sin((0.5 * phi1)), 2.0) tmp = 0 if (phi1 <= -4.6e-8) or not (phi1 <= 0.000108): tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + t_3)), math.sqrt((1.0 - (t_3 + (math.cos(phi1) * t_2)))))) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - ((math.cos(phi2) * t_2) + math.pow(math.sin((0.5 * phi2)), 2.0)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 t_3 = sin(Float64(0.5 * phi1)) ^ 2.0 tmp = 0.0 if ((phi1 <= -4.6e-8) || !(phi1 <= 0.000108)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + t_3)), sqrt(Float64(1.0 - Float64(t_3 + Float64(cos(phi1) * t_2))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - Float64(Float64(cos(phi2) * t_2) + (sin(Float64(0.5 * phi2)) ^ 2.0))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; t_3 = sin((0.5 * phi1)) ^ 2.0; tmp = 0.0; if ((phi1 <= -4.6e-8) || ~((phi1 <= 0.000108))) tmp = R * (2.0 * atan2(sqrt((t_1 + t_3)), sqrt((1.0 - (t_3 + (cos(phi1) * t_2)))))); else tmp = R * (2.0 * atan2(sqrt((t_1 + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - ((cos(phi2) * t_2) + (sin((0.5 * phi2)) ^ 2.0)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[phi1, -4.6e-8], N[Not[LessEqual[phi1, 0.000108]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + t$95$3), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$3 + N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
t_3 := {\sin \left(0.5 \cdot \phi_1\right)}^{2}\\
\mathbf{if}\;\phi_1 \leq -4.6 \cdot 10^{-8} \lor \neg \left(\phi_1 \leq 0.000108\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + t_3}}{\sqrt{1 - \left(t_3 + \cos \phi_1 \cdot t_2\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_2 \cdot t_2 + {\sin \left(0.5 \cdot \phi_2\right)}^{2}\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (* 0.5 lambda1)))
(t_1 (* (cos phi1) (cos phi2)))
(t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
(t_3 (sin (/ (- lambda1 lambda2) 2.0))))
(if (or (<= phi2 -0.00096) (not (<= phi2 1350000.0)))
(*
R
(*
2.0
(atan2
(sqrt (+ (* (cos phi2) t_2) (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt
(-
1.0
(+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* t_0 (* t_1 t_0))))))))
(*
R
(*
2.0
(atan2
(sqrt (+ (* t_3 (* t_1 t_3)) (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))
(sqrt
(- 1.0 (+ (pow (sin (* 0.5 phi1)) 2.0) (* (cos phi1) t_2))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * lambda1));
double t_1 = cos(phi1) * cos(phi2);
double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = sin(((lambda1 - lambda2) / 2.0));
double tmp;
if ((phi2 <= -0.00096) || !(phi2 <= 1350000.0)) {
tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_2) + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - (pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (t_0 * (t_1 * t_0)))))));
} else {
tmp = R * (2.0 * atan2(sqrt(((t_3 * (t_1 * t_3)) + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - (pow(sin((0.5 * phi1)), 2.0) + (cos(phi1) * t_2))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin((0.5d0 * lambda1))
t_1 = cos(phi1) * cos(phi2)
t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
t_3 = sin(((lambda1 - lambda2) / 2.0d0))
if ((phi2 <= (-0.00096d0)) .or. (.not. (phi2 <= 1350000.0d0))) then
tmp = r * (2.0d0 * atan2(sqrt(((cos(phi2) * t_2) + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - ((sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (t_0 * (t_1 * t_0)))))))
else
tmp = r * (2.0d0 * atan2(sqrt(((t_3 * (t_1 * t_3)) + (0.5d0 - (cos((phi1 - phi2)) / 2.0d0)))), sqrt((1.0d0 - ((sin((0.5d0 * phi1)) ** 2.0d0) + (cos(phi1) * t_2))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((0.5 * lambda1));
double t_1 = Math.cos(phi1) * Math.cos(phi2);
double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double t_3 = Math.sin(((lambda1 - lambda2) / 2.0));
double tmp;
if ((phi2 <= -0.00096) || !(phi2 <= 1350000.0)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * t_2) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - (Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (t_0 * (t_1 * t_0)))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((t_3 * (t_1 * t_3)) + (0.5 - (Math.cos((phi1 - phi2)) / 2.0)))), Math.sqrt((1.0 - (Math.pow(Math.sin((0.5 * phi1)), 2.0) + (Math.cos(phi1) * t_2))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin((0.5 * lambda1)) t_1 = math.cos(phi1) * math.cos(phi2) t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) t_3 = math.sin(((lambda1 - lambda2) / 2.0)) tmp = 0 if (phi2 <= -0.00096) or not (phi2 <= 1350000.0): tmp = R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * t_2) + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - (math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (t_0 * (t_1 * t_0))))))) else: tmp = R * (2.0 * math.atan2(math.sqrt(((t_3 * (t_1 * t_3)) + (0.5 - (math.cos((phi1 - phi2)) / 2.0)))), math.sqrt((1.0 - (math.pow(math.sin((0.5 * phi1)), 2.0) + (math.cos(phi1) * t_2)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * lambda1)) t_1 = Float64(cos(phi1) * cos(phi2)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 t_3 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) tmp = 0.0 if ((phi2 <= -0.00096) || !(phi2 <= 1350000.0)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * t_2) + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(t_0 * Float64(t_1 * t_0)))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_3 * Float64(t_1 * t_3)) + Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))), sqrt(Float64(1.0 - Float64((sin(Float64(0.5 * phi1)) ^ 2.0) + Float64(cos(phi1) * t_2))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * lambda1)); t_1 = cos(phi1) * cos(phi2); t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; t_3 = sin(((lambda1 - lambda2) / 2.0)); tmp = 0.0; if ((phi2 <= -0.00096) || ~((phi2 <= 1350000.0))) tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_2) + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - ((sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (t_0 * (t_1 * t_0))))))); else tmp = R * (2.0 * atan2(sqrt(((t_3 * (t_1 * t_3)) + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - ((sin((0.5 * phi1)) ^ 2.0) + (cos(phi1) * t_2)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -0.00096], N[Not[LessEqual[phi2, 1350000.0]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$3 * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \lambda_1\right)\\
t_1 := \cos \phi_1 \cdot \cos \phi_2\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
\mathbf{if}\;\phi_2 \leq -0.00096 \lor \neg \left(\phi_2 \leq 1350000\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot t_2 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t_0 \cdot \left(t_1 \cdot t_0\right)\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_3 \cdot \left(t_1 \cdot t_3\right) + \left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot t_2\right)}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (pow (sin (* phi2 -0.5)) 2.0))
(t_1 (sin (/ (- lambda1 lambda2) 2.0)))
(t_2 (sin (* 0.5 (- lambda1 lambda2))))
(t_3 (pow t_2 4.0))
(t_4 (pow t_2 2.0)))
(if (<= t_1 -0.05)
(*
R
(*
2.0
(atan2
(sqrt (+ t_0 (* (cos phi2) (cbrt (* t_4 t_3)))))
(sqrt (- 1.0 t_4)))))
(if (<= t_1 5e-9)
(*
R
(*
2.0
(atan2
(sqrt
(+
(* t_1 (* (* (cos phi1) (cos phi2)) t_1))
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0))))))
(*
R
(*
2.0
(atan2
(sqrt (+ (* (cos phi2) t_4) t_0))
(sqrt (- 1.0 (sqrt t_3))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = pow(sin((phi2 * -0.5)), 2.0);
double t_1 = sin(((lambda1 - lambda2) / 2.0));
double t_2 = sin((0.5 * (lambda1 - lambda2)));
double t_3 = pow(t_2, 4.0);
double t_4 = pow(t_2, 2.0);
double tmp;
if (t_1 <= -0.05) {
tmp = R * (2.0 * atan2(sqrt((t_0 + (cos(phi2) * cbrt((t_4 * t_3))))), sqrt((1.0 - t_4))));
} else if (t_1 <= 5e-9) {
tmp = R * (2.0 * atan2(sqrt(((t_1 * ((cos(phi1) * cos(phi2)) * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - pow(sin((0.5 * (phi1 - phi2))), 2.0)))));
} else {
tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_4) + t_0)), sqrt((1.0 - sqrt(t_3)))));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.pow(Math.sin((phi2 * -0.5)), 2.0);
double t_1 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_2 = Math.sin((0.5 * (lambda1 - lambda2)));
double t_3 = Math.pow(t_2, 4.0);
double t_4 = Math.pow(t_2, 2.0);
double tmp;
if (t_1 <= -0.05) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_0 + (Math.cos(phi2) * Math.cbrt((t_4 * t_3))))), Math.sqrt((1.0 - t_4))));
} else if (t_1 <= 5e-9) {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((t_1 * ((Math.cos(phi1) * Math.cos(phi2)) * t_1)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0)))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * t_4) + t_0)), Math.sqrt((1.0 - Math.sqrt(t_3)))));
}
return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(phi2 * -0.5)) ^ 2.0 t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) t_3 = t_2 ^ 4.0 t_4 = t_2 ^ 2.0 tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_0 + Float64(cos(phi2) * cbrt(Float64(t_4 * t_3))))), sqrt(Float64(1.0 - t_4))))); elseif (t_1 <= 5e-9) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * Float64(Float64(cos(phi1) * cos(phi2)) * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0)))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * t_4) + t_0)), sqrt(Float64(1.0 - sqrt(t_3)))))); end return tmp end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, 4.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[t$95$2, 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 + N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[(t$95$4 * t$95$3), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$4), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-9], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$4), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin \left(\phi_2 \cdot -0.5\right)}^{2}\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_3 := {t_2}^{4}\\
t_4 := {t_2}^{2}\\
\mathbf{if}\;t_1 \leq -0.05:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + \cos \phi_2 \cdot \sqrt[3]{t_4 \cdot t_3}}}{\sqrt{1 - t_4}}\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-9}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot t_4 + t_0}}{\sqrt{1 - \sqrt{t_3}}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
(t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0))))
(if (or (<= (- lambda1 lambda2) -0.2) (not (<= (- lambda1 lambda2) 1e-8)))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))
(sqrt
(-
1.0
(+
(pow (sin (* 0.5 phi1)) 2.0)
(* (cos phi1) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))))))))
(*
R
(*
2.0
(atan2
(sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
double tmp;
if (((lambda1 - lambda2) <= -0.2) || !((lambda1 - lambda2) <= 1e-8)) {
tmp = R * (2.0 * atan2(sqrt((t_1 + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - (pow(sin((0.5 * phi1)), 2.0) + (cos(phi1) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0)))))));
} else {
tmp = R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - pow(sin((0.5 * (phi1 - phi2))), 2.0)))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
if (((lambda1 - lambda2) <= (-0.2d0)) .or. (.not. ((lambda1 - lambda2) <= 1d-8))) then
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (0.5d0 - (cos((phi1 - phi2)) / 2.0d0)))), sqrt((1.0d0 - ((sin((0.5d0 * phi1)) ** 2.0d0) + (cos(phi1) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)))))))
else
tmp = r * (2.0d0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - (sin((0.5d0 * (phi1 - phi2))) ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
double tmp;
if (((lambda1 - lambda2) <= -0.2) || !((lambda1 - lambda2) <= 1e-8)) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + (0.5 - (Math.cos((phi1 - phi2)) / 2.0)))), Math.sqrt((1.0 - (Math.pow(Math.sin((0.5 * phi1)), 2.0) + (Math.cos(phi1) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)))))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0)))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0) tmp = 0 if ((lambda1 - lambda2) <= -0.2) or not ((lambda1 - lambda2) <= 1e-8): tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + (0.5 - (math.cos((phi1 - phi2)) / 2.0)))), math.sqrt((1.0 - (math.pow(math.sin((0.5 * phi1)), 2.0) + (math.cos(phi1) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0))))))) else: tmp = R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) tmp = 0.0 if ((Float64(lambda1 - lambda2) <= -0.2) || !(Float64(lambda1 - lambda2) <= 1e-8)) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))), sqrt(Float64(1.0 - Float64((sin(Float64(0.5 * phi1)) ^ 2.0) + Float64(cos(phi1) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)))))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0)))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0); tmp = 0.0; if (((lambda1 - lambda2) <= -0.2) || ~(((lambda1 - lambda2) <= 1e-8))) tmp = R * (2.0 * atan2(sqrt((t_1 + (0.5 - (cos((phi1 - phi2)) / 2.0)))), sqrt((1.0 - ((sin((0.5 * phi1)) ^ 2.0) + (cos(phi1) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0))))))); else tmp = R * (2.0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - (sin((0.5 * (phi1 - phi2))) ^ 2.0))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(lambda1 - lambda2), $MachinePrecision], -0.2], N[Not[LessEqual[N[(lambda1 - lambda2), $MachinePrecision], 1e-8]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right)\\
\mathbf{if}\;\lambda_1 - \lambda_2 \leq -0.2 \lor \neg \left(\lambda_1 - \lambda_2 \leq 10^{-8}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + \left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}}{\sqrt{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (* 0.5 (- lambda1 lambda2))))
(t_1 (sin (/ (- lambda1 lambda2) 2.0)))
(t_2 (pow t_0 2.0))
(t_3 (sqrt (+ (* (cos phi2) t_2) (pow (sin (* phi2 -0.5)) 2.0)))))
(if (<= t_1 -0.05)
(* R (* 2.0 (atan2 t_3 (sqrt (- 1.0 t_2)))))
(if (<= t_1 5e-9)
(*
R
(*
2.0
(atan2
(sqrt
(+
(* t_1 (* (* (cos phi1) (cos phi2)) t_1))
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0))))))
(* R (* 2.0 (atan2 t_3 (sqrt (- 1.0 (sqrt (pow t_0 4.0)))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * (lambda1 - lambda2)));
double t_1 = sin(((lambda1 - lambda2) / 2.0));
double t_2 = pow(t_0, 2.0);
double t_3 = sqrt(((cos(phi2) * t_2) + pow(sin((phi2 * -0.5)), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = R * (2.0 * atan2(t_3, sqrt((1.0 - t_2))));
} else if (t_1 <= 5e-9) {
tmp = R * (2.0 * atan2(sqrt(((t_1 * ((cos(phi1) * cos(phi2)) * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - pow(sin((0.5 * (phi1 - phi2))), 2.0)))));
} else {
tmp = R * (2.0 * atan2(t_3, sqrt((1.0 - sqrt(pow(t_0, 4.0))))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin((0.5d0 * (lambda1 - lambda2)))
t_1 = sin(((lambda1 - lambda2) / 2.0d0))
t_2 = t_0 ** 2.0d0
t_3 = sqrt(((cos(phi2) * t_2) + (sin((phi2 * (-0.5d0))) ** 2.0d0)))
if (t_1 <= (-0.05d0)) then
tmp = r * (2.0d0 * atan2(t_3, sqrt((1.0d0 - t_2))))
else if (t_1 <= 5d-9) then
tmp = r * (2.0d0 * atan2(sqrt(((t_1 * ((cos(phi1) * cos(phi2)) * t_1)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - (sin((0.5d0 * (phi1 - phi2))) ** 2.0d0)))))
else
tmp = r * (2.0d0 * atan2(t_3, sqrt((1.0d0 - sqrt((t_0 ** 4.0d0))))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((0.5 * (lambda1 - lambda2)));
double t_1 = Math.sin(((lambda1 - lambda2) / 2.0));
double t_2 = Math.pow(t_0, 2.0);
double t_3 = Math.sqrt(((Math.cos(phi2) * t_2) + Math.pow(Math.sin((phi2 * -0.5)), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = R * (2.0 * Math.atan2(t_3, Math.sqrt((1.0 - t_2))));
} else if (t_1 <= 5e-9) {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((t_1 * ((Math.cos(phi1) * Math.cos(phi2)) * t_1)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0)))));
} else {
tmp = R * (2.0 * Math.atan2(t_3, Math.sqrt((1.0 - Math.sqrt(Math.pow(t_0, 4.0))))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin((0.5 * (lambda1 - lambda2))) t_1 = math.sin(((lambda1 - lambda2) / 2.0)) t_2 = math.pow(t_0, 2.0) t_3 = math.sqrt(((math.cos(phi2) * t_2) + math.pow(math.sin((phi2 * -0.5)), 2.0))) tmp = 0 if t_1 <= -0.05: tmp = R * (2.0 * math.atan2(t_3, math.sqrt((1.0 - t_2)))) elif t_1 <= 5e-9: tmp = R * (2.0 * math.atan2(math.sqrt(((t_1 * ((math.cos(phi1) * math.cos(phi2)) * t_1)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0))))) else: tmp = R * (2.0 * math.atan2(t_3, math.sqrt((1.0 - math.sqrt(math.pow(t_0, 4.0)))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) t_2 = t_0 ^ 2.0 t_3 = sqrt(Float64(Float64(cos(phi2) * t_2) + (sin(Float64(phi2 * -0.5)) ^ 2.0))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(R * Float64(2.0 * atan(t_3, sqrt(Float64(1.0 - t_2))))); elseif (t_1 <= 5e-9) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * Float64(Float64(cos(phi1) * cos(phi2)) * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0)))))); else tmp = Float64(R * Float64(2.0 * atan(t_3, sqrt(Float64(1.0 - sqrt((t_0 ^ 4.0))))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * (lambda1 - lambda2))); t_1 = sin(((lambda1 - lambda2) / 2.0)); t_2 = t_0 ^ 2.0; t_3 = sqrt(((cos(phi2) * t_2) + (sin((phi2 * -0.5)) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.05) tmp = R * (2.0 * atan2(t_3, sqrt((1.0 - t_2)))); elseif (t_1 <= 5e-9) tmp = R * (2.0 * atan2(sqrt(((t_1 * ((cos(phi1) * cos(phi2)) * t_1)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - (sin((0.5 * (phi1 - phi2))) ^ 2.0))))); else tmp = R * (2.0 * atan2(t_3, sqrt((1.0 - sqrt((t_0 ^ 4.0)))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(R * N[(2.0 * N[ArcTan[t$95$3 / N[Sqrt[N[(1.0 - t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-9], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$3 / N[Sqrt[N[(1.0 - N[Sqrt[N[Power[t$95$0, 4.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {t_0}^{2}\\
t_3 := \sqrt{\cos \phi_2 \cdot t_2 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -0.05:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{1 - t_2}}\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-9}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{1 - \sqrt{{t_0}^{4}}}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0))))
(*
R
(*
2.0
(atan2
(sqrt
(+
(* t_0 (* (* (cos phi1) (cos phi2)) t_0))
(pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(((lambda1 - lambda2) / 2.0));
return R * (2.0 * atan2(sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - pow(sin((0.5 * (lambda1 - lambda2))), 2.0)))));
}
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
real(8) :: t_0
t_0 = sin(((lambda1 - lambda2) / 2.0d0))
code = r * (2.0d0 * atan2(sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 - (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
return R * (2.0 * Math.atan2(Math.sqrt(((t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin(((lambda1 - lambda2) / 2.0)) return R * (2.0 * math.atan2(math.sqrt(((t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 - math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0)) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(((lambda1 - lambda2) / 2.0)); tmp = R * (2.0 * atan2(sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 - (sin((0.5 * (lambda1 - lambda2))) ^ 2.0))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (* 0.5 (- lambda1 lambda2)))))
(*
R
(*
2.0
(atan2
(sqrt (+ (* (cos phi2) (pow t_0 2.0)) (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt (- 1.0 (sqrt (pow t_0 4.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * (lambda1 - lambda2)));
return R * (2.0 * atan2(sqrt(((cos(phi2) * pow(t_0, 2.0)) + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - sqrt(pow(t_0, 4.0))))));
}
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
real(8) :: t_0
t_0 = sin((0.5d0 * (lambda1 - lambda2)))
code = r * (2.0d0 * atan2(sqrt(((cos(phi2) * (t_0 ** 2.0d0)) + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - sqrt((t_0 ** 4.0d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((0.5 * (lambda1 - lambda2)));
return R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * Math.pow(t_0, 2.0)) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - Math.sqrt(Math.pow(t_0, 4.0))))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin((0.5 * (lambda1 - lambda2))) return R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * math.pow(t_0, 2.0)) + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - math.sqrt(math.pow(t_0, 4.0))))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * (t_0 ^ 2.0)) + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - sqrt((t_0 ^ 4.0))))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * (lambda1 - lambda2))); tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * (t_0 ^ 2.0)) + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - sqrt((t_0 ^ 4.0)))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Sqrt[N[Power[t$95$0, 4.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot {t_0}^{2} + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \sqrt{{t_0}^{4}}}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(sqrt
(+
(* (cos phi2) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
(pow (sin (* phi2 -0.5)) 2.0)))))
(if (<= lambda2 -240.0)
(* R (* 2.0 (atan2 t_0 (sqrt (- 1.0 (pow (sin (* lambda2 -0.5)) 2.0))))))
(*
R
(* 2.0 (atan2 t_0 (sqrt (- 1.0 (pow (sin (* 0.5 lambda1)) 2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sqrt(((cos(phi2) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0)) + pow(sin((phi2 * -0.5)), 2.0)));
double tmp;
if (lambda2 <= -240.0) {
tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - pow(sin((lambda2 * -0.5)), 2.0)))));
} else {
tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - pow(sin((0.5 * lambda1)), 2.0)))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((cos(phi2) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)) + (sin((phi2 * (-0.5d0))) ** 2.0d0)))
if (lambda2 <= (-240.0d0)) then
tmp = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 - (sin((lambda2 * (-0.5d0))) ** 2.0d0)))))
else
tmp = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 - (sin((0.5d0 * lambda1)) ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sqrt(((Math.cos(phi2) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)) + Math.pow(Math.sin((phi2 * -0.5)), 2.0)));
double tmp;
if (lambda2 <= -240.0) {
tmp = R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 - Math.pow(Math.sin((lambda2 * -0.5)), 2.0)))));
} else {
tmp = R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * lambda1)), 2.0)))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sqrt(((math.cos(phi2) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)) + math.pow(math.sin((phi2 * -0.5)), 2.0))) tmp = 0 if lambda2 <= -240.0: tmp = R * (2.0 * math.atan2(t_0, math.sqrt((1.0 - math.pow(math.sin((lambda2 * -0.5)), 2.0))))) else: tmp = R * (2.0 * math.atan2(t_0, math.sqrt((1.0 - math.pow(math.sin((0.5 * lambda1)), 2.0))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sqrt(Float64(Float64(cos(phi2) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)) + (sin(Float64(phi2 * -0.5)) ^ 2.0))) tmp = 0.0 if (lambda2 <= -240.0) tmp = Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 - (sin(Float64(lambda2 * -0.5)) ^ 2.0)))))); else tmp = Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 - (sin(Float64(0.5 * lambda1)) ^ 2.0)))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sqrt(((cos(phi2) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0)) + (sin((phi2 * -0.5)) ^ 2.0))); tmp = 0.0; if (lambda2 <= -240.0) tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - (sin((lambda2 * -0.5)) ^ 2.0))))); else tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - (sin((0.5 * lambda1)) ^ 2.0))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -240.0], N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(lambda2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}\\
\mathbf{if}\;\lambda_2 \leq -240:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_0}{\sqrt{1 - {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_0}{\sqrt{1 - {\sin \left(0.5 \cdot \lambda_1\right)}^{2}}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (pow (sin (* phi2 -0.5)) 2.0))
(t_1 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
(if (<= lambda2 -520.0)
(*
R
(*
2.0
(atan2
(sqrt (+ t_0 (* (cos phi2) (pow (sin (* lambda2 -0.5)) 2.0))))
(sqrt (- 1.0 t_1)))))
(*
R
(*
2.0
(atan2
(sqrt (+ (* (cos phi2) t_1) t_0))
(sqrt (- 1.0 (pow (sin (* 0.5 lambda1)) 2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = pow(sin((phi2 * -0.5)), 2.0);
double t_1 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if (lambda2 <= -520.0) {
tmp = R * (2.0 * atan2(sqrt((t_0 + (cos(phi2) * pow(sin((lambda2 * -0.5)), 2.0)))), sqrt((1.0 - t_1))));
} else {
tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_1) + t_0)), sqrt((1.0 - pow(sin((0.5 * lambda1)), 2.0)))));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((phi2 * (-0.5d0))) ** 2.0d0
t_1 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
if (lambda2 <= (-520.0d0)) then
tmp = r * (2.0d0 * atan2(sqrt((t_0 + (cos(phi2) * (sin((lambda2 * (-0.5d0))) ** 2.0d0)))), sqrt((1.0d0 - t_1))))
else
tmp = r * (2.0d0 * atan2(sqrt(((cos(phi2) * t_1) + t_0)), sqrt((1.0d0 - (sin((0.5d0 * lambda1)) ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.pow(Math.sin((phi2 * -0.5)), 2.0);
double t_1 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
double tmp;
if (lambda2 <= -520.0) {
tmp = R * (2.0 * Math.atan2(Math.sqrt((t_0 + (Math.cos(phi2) * Math.pow(Math.sin((lambda2 * -0.5)), 2.0)))), Math.sqrt((1.0 - t_1))));
} else {
tmp = R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * t_1) + t_0)), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * lambda1)), 2.0)))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.pow(math.sin((phi2 * -0.5)), 2.0) t_1 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) tmp = 0 if lambda2 <= -520.0: tmp = R * (2.0 * math.atan2(math.sqrt((t_0 + (math.cos(phi2) * math.pow(math.sin((lambda2 * -0.5)), 2.0)))), math.sqrt((1.0 - t_1)))) else: tmp = R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * t_1) + t_0)), math.sqrt((1.0 - math.pow(math.sin((0.5 * lambda1)), 2.0))))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(phi2 * -0.5)) ^ 2.0 t_1 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 tmp = 0.0 if (lambda2 <= -520.0) tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_0 + Float64(cos(phi2) * (sin(Float64(lambda2 * -0.5)) ^ 2.0)))), sqrt(Float64(1.0 - t_1))))); else tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * t_1) + t_0)), sqrt(Float64(1.0 - (sin(Float64(0.5 * lambda1)) ^ 2.0)))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((phi2 * -0.5)) ^ 2.0; t_1 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; tmp = 0.0; if (lambda2 <= -520.0) tmp = R * (2.0 * atan2(sqrt((t_0 + (cos(phi2) * (sin((lambda2 * -0.5)) ^ 2.0)))), sqrt((1.0 - t_1)))); else tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_1) + t_0)), sqrt((1.0 - (sin((0.5 * lambda1)) ^ 2.0))))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[lambda2, -520.0], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 + N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(lambda2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin \left(\phi_2 \cdot -0.5\right)}^{2}\\
t_1 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
\mathbf{if}\;\lambda_2 \leq -520:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + \cos \phi_2 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - t_1}}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot t_1 + t_0}}{\sqrt{1 - {\sin \left(0.5 \cdot \lambda_1\right)}^{2}}}\right)\\
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
(*
R
(*
2.0
(atan2
(sqrt (+ (* (cos phi2) t_0) (pow (sin (* phi2 -0.5)) 2.0)))
(sqrt (- 1.0 t_0)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
return R * (2.0 * atan2(sqrt(((cos(phi2) * t_0) + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - t_0))));
}
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
real(8) :: t_0
t_0 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
code = r * (2.0d0 * atan2(sqrt(((cos(phi2) * t_0) + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - t_0))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
return R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * t_0) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - t_0))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0) return R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * t_0) + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - t_0))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0 return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * t_0) + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - t_0))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0; tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * t_0) + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - t_0)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot t_0 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - t_0}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(*
R
(*
2.0
(atan2
(sqrt
(+
(* (cos phi2) (pow (sin (* 0.5 lambda1)) 2.0))
(pow (sin (* phi2 -0.5)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * (2.0 * atan2(sqrt(((cos(phi2) * pow(sin((0.5 * lambda1)), 2.0)) + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - pow(sin((0.5 * (lambda1 - lambda2))), 2.0)))));
}
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 = r * (2.0d0 * atan2(sqrt(((cos(phi2) * (sin((0.5d0 * lambda1)) ** 2.0d0)) + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * Math.pow(Math.sin((0.5 * lambda1)), 2.0)) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)))));
}
def code(R, lambda1, lambda2, phi1, phi2): return R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * math.pow(math.sin((0.5 * lambda1)), 2.0)) + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)))))
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * (sin(Float64(0.5 * lambda1)) ^ 2.0)) + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * (sin((0.5 * lambda1)) ^ 2.0)) + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - (sin((0.5 * (lambda1 - lambda2))) ^ 2.0))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot {\sin \left(0.5 \cdot \lambda_1\right)}^{2} + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(*
R
(*
2.0
(atan2
(sqrt
(+
(* (cos phi2) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
(pow (sin (* phi2 -0.5)) 2.0)))
(sqrt (- 1.0 (pow (sin (* 0.5 lambda1)) 2.0)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * (2.0 * atan2(sqrt(((cos(phi2) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0)) + pow(sin((phi2 * -0.5)), 2.0))), sqrt((1.0 - pow(sin((0.5 * lambda1)), 2.0)))));
}
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 = r * (2.0d0 * atan2(sqrt(((cos(phi2) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0)) + (sin((phi2 * (-0.5d0))) ** 2.0d0))), sqrt((1.0d0 - (sin((0.5d0 * lambda1)) ** 2.0d0)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi2) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0)) + Math.pow(Math.sin((phi2 * -0.5)), 2.0))), Math.sqrt((1.0 - Math.pow(Math.sin((0.5 * lambda1)), 2.0)))));
}
def code(R, lambda1, lambda2, phi1, phi2): return R * (2.0 * math.atan2(math.sqrt(((math.cos(phi2) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)) + math.pow(math.sin((phi2 * -0.5)), 2.0))), math.sqrt((1.0 - math.pow(math.sin((0.5 * lambda1)), 2.0)))))
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi2) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)) + (sin(Float64(phi2 * -0.5)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(0.5 * lambda1)) ^ 2.0)))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * (2.0 * atan2(sqrt(((cos(phi2) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0)) + (sin((phi2 * -0.5)) ^ 2.0))), sqrt((1.0 - (sin((0.5 * lambda1)) ^ 2.0))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(phi2 * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - {\sin \left(0.5 \cdot \lambda_1\right)}^{2}}}\right)
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (* 0.5 (- lambda1 lambda2)))) (t_1 (pow t_0 2.0)))
(*
R
(*
2.0
(atan2
(+ t_0 (* 0.5 (/ (pow phi2 2.0) (/ t_0 (+ 0.25 (* t_1 -0.5))))))
(sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * (lambda1 - lambda2)));
double t_1 = pow(t_0, 2.0);
return R * (2.0 * atan2((t_0 + (0.5 * (pow(phi2, 2.0) / (t_0 / (0.25 + (t_1 * -0.5)))))), sqrt((1.0 - t_1))));
}
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
real(8) :: t_0
real(8) :: t_1
t_0 = sin((0.5d0 * (lambda1 - lambda2)))
t_1 = t_0 ** 2.0d0
code = r * (2.0d0 * atan2((t_0 + (0.5d0 * ((phi2 ** 2.0d0) / (t_0 / (0.25d0 + (t_1 * (-0.5d0))))))), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((0.5 * (lambda1 - lambda2)));
double t_1 = Math.pow(t_0, 2.0);
return R * (2.0 * Math.atan2((t_0 + (0.5 * (Math.pow(phi2, 2.0) / (t_0 / (0.25 + (t_1 * -0.5)))))), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin((0.5 * (lambda1 - lambda2))) t_1 = math.pow(t_0, 2.0) return R * (2.0 * math.atan2((t_0 + (0.5 * (math.pow(phi2, 2.0) / (t_0 / (0.25 + (t_1 * -0.5)))))), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) t_1 = t_0 ^ 2.0 return Float64(R * Float64(2.0 * atan(Float64(t_0 + Float64(0.5 * Float64((phi2 ^ 2.0) / Float64(t_0 / Float64(0.25 + Float64(t_1 * -0.5)))))), sqrt(Float64(1.0 - t_1))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * (lambda1 - lambda2))); t_1 = t_0 ^ 2.0; tmp = R * (2.0 * atan2((t_0 + (0.5 * ((phi2 ^ 2.0) / (t_0 / (0.25 + (t_1 * -0.5)))))), sqrt((1.0 - t_1)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[(t$95$0 + N[(0.5 * N[(N[Power[phi2, 2.0], $MachinePrecision] / N[(t$95$0 / N[(0.25 + N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_1 := {t_0}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_0 + 0.5 \cdot \frac{{\phi_2}^{2}}{\frac{t_0}{0.25 + t_1 \cdot -0.5}}}{\sqrt{1 - t_1}}\right)
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (let* ((t_0 (sin (* 0.5 (- lambda1 lambda2))))) (* R (* 2.0 (atan2 t_0 (sqrt (- 1.0 (pow t_0 2.0))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((0.5 * (lambda1 - lambda2)));
return R * (2.0 * atan2(t_0, sqrt((1.0 - pow(t_0, 2.0)))));
}
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
real(8) :: t_0
t_0 = sin((0.5d0 * (lambda1 - lambda2)))
code = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 - (t_0 ** 2.0d0)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((0.5 * (lambda1 - lambda2)));
return R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 - Math.pow(t_0, 2.0)))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.sin((0.5 * (lambda1 - lambda2))) return R * (2.0 * math.atan2(t_0, math.sqrt((1.0 - math.pow(t_0, 2.0)))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) return Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 - (t_0 ^ 2.0)))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = sin((0.5 * (lambda1 - lambda2))); tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - (t_0 ^ 2.0))))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 - N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_0}{\sqrt{1 - {t_0}^{2}}}\right)
\end{array}
\end{array}
herbie shell --seed 2024010
(FPCore (R lambda1 lambda2 phi1 phi2)
:name "Distance on a great circle"
:precision binary64
(* R (* 2.0 (atan2 (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))) (sqrt (- 1.0 (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))))))))