
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 31 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(*
(cos phi2)
(*
(sin phi1)
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2)))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}
\end{array}
Initial program 81.0%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
cos-diff99.7%
distribute-lft-in99.7%
*-commutative99.7%
Applied egg-rr99.7%
distribute-lft-out99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
fma-undefine99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))))
(if (or (<= phi2 -5e-13) (not (<= phi2 6.5e-12)))
(atan2
t_0
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
t_0
(-
(sin phi2)
(*
(cos phi2)
(*
(sin phi1)
(fma
(cos lambda1)
(cos lambda2)
(* (sin lambda1) (sin lambda2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2);
double tmp;
if ((phi2 <= -5e-13) || !(phi2 <= 6.5e-12)) {
tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_0, (sin(phi2) - (cos(phi2) * (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2)))))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)) tmp = 0.0 if ((phi2 <= -5e-13) || !(phi2 <= 6.5e-12)) tmp = atan(t_0, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(phi2) * Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -5e-13], N[Not[LessEqual[phi2, 6.5e-12]], $MachinePrecision]], N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_2 \leq -5 \cdot 10^{-13} \lor \neg \left(\phi_2 \leq 6.5 \cdot 10^{-12}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\\
\end{array}
\end{array}
if phi2 < -4.9999999999999999e-13 or 6.5000000000000002e-12 < phi2 Initial program 78.8%
sin-diff89.2%
sub-neg89.2%
Applied egg-rr89.2%
sub-neg89.2%
Simplified89.2%
if -4.9999999999999999e-13 < phi2 < 6.5000000000000002e-12Initial program 83.4%
sin-diff89.0%
sub-neg89.0%
Applied egg-rr89.0%
sub-neg89.0%
Simplified89.0%
cos-diff99.9%
distribute-lft-in99.8%
*-commutative99.8%
Applied egg-rr99.8%
distribute-lft-out99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
fma-undefine99.9%
Simplified99.9%
Taylor expanded in phi1 around 0 99.9%
Final simplification94.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))))
(if (or (<= phi2 -5e-6) (not (<= phi2 5.8e-9)))
(atan2
(* t_1 (cos phi2))
(- t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
t_1
(-
t_0
(*
(cos phi2)
(*
(sin phi1)
(fma
(cos lambda1)
(cos lambda2)
(* (sin lambda1) (sin lambda2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = (sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2));
double tmp;
if ((phi2 <= -5e-6) || !(phi2 <= 5.8e-9)) {
tmp = atan2((t_1 * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2)))))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) tmp = 0.0 if ((phi2 <= -5e-6) || !(phi2 <= 5.8e-9)) tmp = atan(Float64(t_1 * cos(phi2)), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_1, Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -5e-6], N[Not[LessEqual[phi2, 5.8e-9]], $MachinePrecision]], N[ArcTan[N[(t$95$1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_2 \leq -5 \cdot 10^{-6} \lor \neg \left(\phi_2 \leq 5.8 \cdot 10^{-9}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_1 \cdot \cos \phi_2}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\\
\end{array}
\end{array}
if phi2 < -5.00000000000000041e-6 or 5.79999999999999982e-9 < phi2 Initial program 78.5%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
if -5.00000000000000041e-6 < phi2 < 5.79999999999999982e-9Initial program 83.7%
sin-diff89.2%
sub-neg89.2%
Applied egg-rr89.2%
sub-neg89.2%
Simplified89.2%
cos-diff99.9%
distribute-lft-in99.8%
*-commutative99.8%
Applied egg-rr99.8%
distribute-lft-out99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
fma-undefine99.9%
Simplified99.9%
Taylor expanded in phi2 around 0 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification94.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(*
(cos phi2)
(*
(sin phi1)
(+ (* (sin lambda1) (sin lambda2)) (* (cos lambda2) (cos lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1)))))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1)))))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(phi2) * (Math.sin(phi1) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1)))))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(phi2) * (math.sin(phi1) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1)))))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1))))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)\right)}
\end{array}
Initial program 81.0%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
cos-diff99.7%
distribute-lft-in99.7%
*-commutative99.7%
Applied egg-rr99.7%
distribute-lft-out99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
fma-undefine99.7%
Simplified99.7%
Taylor expanded in phi1 around inf 99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(+ (* (sin lambda1) (sin lambda2)) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1))))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1)))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 81.0%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
cos-diff99.7%
+-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda1 -0.00027) (not (<= lambda1 7.2e-7)))
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda1) t_1)))
(atan2
(* (cos phi2) (- (* lambda1 (cos lambda2)) (sin lambda2)))
(- t_0 (* t_1 (+ (cos lambda2) (* lambda1 (sin lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda1 <= -0.00027) || !(lambda1 <= 7.2e-7)) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1)));
} else {
tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
if ((lambda1 <= (-0.00027d0)) .or. (.not. (lambda1 <= 7.2d-7))) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1)))
else
tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda1 <= -0.00027) || !(lambda1 <= 7.2e-7)) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (Math.cos(lambda1) * t_1)));
} else {
tmp = Math.atan2((Math.cos(phi2) * ((lambda1 * Math.cos(lambda2)) - Math.sin(lambda2))), (t_0 - (t_1 * (Math.cos(lambda2) + (lambda1 * Math.sin(lambda2))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda1 <= -0.00027) or not (lambda1 <= 7.2e-7): tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (math.cos(lambda1) * t_1))) else: tmp = math.atan2((math.cos(phi2) * ((lambda1 * math.cos(lambda2)) - math.sin(lambda2))), (t_0 - (t_1 * (math.cos(lambda2) + (lambda1 * math.sin(lambda2)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda1 <= -0.00027) || !(lambda1 <= 7.2e-7)) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * t_1))); else tmp = atan(Float64(cos(phi2) * Float64(Float64(lambda1 * cos(lambda2)) - sin(lambda2))), Float64(t_0 - Float64(t_1 * Float64(cos(lambda2) + Float64(lambda1 * sin(lambda2)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda1 <= -0.00027) || ~((lambda1 <= 7.2e-7))) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1))); else tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -0.00027], N[Not[LessEqual[lambda1, 7.2e-7]], $MachinePrecision]], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(lambda1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[(N[Cos[lambda2], $MachinePrecision] + N[(lambda1 * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_1 \leq -0.00027 \lor \neg \left(\lambda_1 \leq 7.2 \cdot 10^{-7}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2\right)}{t\_0 - t\_1 \cdot \left(\cos \lambda_2 + \lambda_1 \cdot \sin \lambda_2\right)}\\
\end{array}
\end{array}
if lambda1 < -2.70000000000000003e-4 or 7.19999999999999989e-7 < lambda1 Initial program 61.7%
sin-diff78.3%
sub-neg78.3%
Applied egg-rr78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in lambda2 around 0 78.7%
if -2.70000000000000003e-4 < lambda1 < 7.19999999999999989e-7Initial program 99.4%
Taylor expanded in lambda1 around 0 99.5%
+-commutative80.8%
sin-neg80.8%
unsub-neg80.8%
cos-neg80.8%
Simplified99.5%
Taylor expanded in lambda1 around 0 99.8%
cos-neg99.8%
+-commutative99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
remove-double-neg99.8%
Simplified99.8%
Final simplification89.5%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.0%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
Final simplification89.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (cos (- lambda1 lambda2)))
(t_3 (sin (- lambda1 lambda2))))
(if (<= phi1 -16000.0)
(atan2 (* (cos phi2) (log1p (expm1 t_3))) (- t_0 (* t_1 t_2)))
(if (<= phi1 1.16e-8)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (sin phi1) t_2)))
(atan2 (* (cos phi2) t_3) (- t_0 (* t_2 (expm1 (log1p t_1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos((lambda1 - lambda2));
double t_3 = sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -16000.0) {
tmp = atan2((cos(phi2) * log1p(expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.16e-8) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (sin(phi1) * t_2)));
} else {
tmp = atan2((cos(phi2) * t_3), (t_0 - (t_2 * expm1(log1p(t_1)))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos((lambda1 - lambda2));
double t_3 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -16000.0) {
tmp = Math.atan2((Math.cos(phi2) * Math.log1p(Math.expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.16e-8) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (Math.sin(phi1) * t_2)));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_3), (t_0 - (t_2 * Math.expm1(Math.log1p(t_1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos((lambda1 - lambda2)) t_3 = math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -16000.0: tmp = math.atan2((math.cos(phi2) * math.log1p(math.expm1(t_3))), (t_0 - (t_1 * t_2))) elif phi1 <= 1.16e-8: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (math.sin(phi1) * t_2))) else: tmp = math.atan2((math.cos(phi2) * t_3), (t_0 - (t_2 * math.expm1(math.log1p(t_1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = cos(Float64(lambda1 - lambda2)) t_3 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -16000.0) tmp = atan(Float64(cos(phi2) * log1p(expm1(t_3))), Float64(t_0 - Float64(t_1 * t_2))); elseif (phi1 <= 1.16e-8) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(sin(phi1) * t_2))); else tmp = atan(Float64(cos(phi2) * t_3), Float64(t_0 - Float64(t_2 * expm1(log1p(t_1))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -16000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Log[1 + N[(Exp[t$95$3] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.16e-8], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_3 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -16000:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_3\right)\right)}{t\_0 - t\_1 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 1.16 \cdot 10^{-8}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \sin \phi_1 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_3}{t\_0 - t\_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -16000Initial program 79.1%
log1p-expm1-u79.1%
Applied egg-rr79.1%
if -16000 < phi1 < 1.15999999999999996e-8Initial program 85.7%
sin-diff99.6%
sub-neg99.6%
Applied egg-rr99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in phi2 around 0 99.4%
if 1.15999999999999996e-8 < phi1 Initial program 75.4%
expm1-log1p-u75.4%
Applied egg-rr75.4%
Final simplification87.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (cos (- lambda1 lambda2)))
(t_3 (sin (- lambda1 lambda2))))
(if (<= phi1 -0.00014)
(atan2 (* (cos phi2) (log1p (expm1 t_3))) (- t_0 (* t_1 t_2)))
(if (<= phi1 1.65e-9)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda2) (* (cos phi2) phi1))))
(atan2 (* (cos phi2) t_3) (- t_0 (* t_2 (expm1 (log1p t_1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos((lambda1 - lambda2));
double t_3 = sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -0.00014) {
tmp = atan2((cos(phi2) * log1p(expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.65e-9) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * phi1))));
} else {
tmp = atan2((cos(phi2) * t_3), (t_0 - (t_2 * expm1(log1p(t_1)))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos((lambda1 - lambda2));
double t_3 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -0.00014) {
tmp = Math.atan2((Math.cos(phi2) * Math.log1p(Math.expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.65e-9) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * (Math.cos(phi2) * phi1))));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_3), (t_0 - (t_2 * Math.expm1(Math.log1p(t_1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos((lambda1 - lambda2)) t_3 = math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -0.00014: tmp = math.atan2((math.cos(phi2) * math.log1p(math.expm1(t_3))), (t_0 - (t_1 * t_2))) elif phi1 <= 1.65e-9: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (math.cos(lambda2) * (math.cos(phi2) * phi1)))) else: tmp = math.atan2((math.cos(phi2) * t_3), (t_0 - (t_2 * math.expm1(math.log1p(t_1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = cos(Float64(lambda1 - lambda2)) t_3 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -0.00014) tmp = atan(Float64(cos(phi2) * log1p(expm1(t_3))), Float64(t_0 - Float64(t_1 * t_2))); elseif (phi1 <= 1.65e-9) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda2) * Float64(cos(phi2) * phi1)))); else tmp = atan(Float64(cos(phi2) * t_3), Float64(t_0 - Float64(t_2 * expm1(log1p(t_1))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -0.00014], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Log[1 + N[(Exp[t$95$3] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.65e-9], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_3 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -0.00014:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_3\right)\right)}{t\_0 - t\_1 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 1.65 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_2 \cdot \left(\cos \phi_2 \cdot \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_3}{t\_0 - t\_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -1.3999999999999999e-4Initial program 79.4%
log1p-expm1-u79.5%
Applied egg-rr79.5%
if -1.3999999999999999e-4 < phi1 < 1.65000000000000009e-9Initial program 85.6%
sin-diff99.6%
sub-neg99.6%
Applied egg-rr99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in lambda1 around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in phi1 around 0 99.6%
if 1.65000000000000009e-9 < phi1 Initial program 75.4%
expm1-log1p-u75.4%
Applied egg-rr75.4%
Final simplification87.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (cos (- lambda1 lambda2)))
(t_3 (sin (- lambda1 lambda2))))
(if (<= phi1 -0.00014)
(atan2 (* (cos phi2) (log1p (expm1 t_3))) (- t_0 (* t_1 t_2)))
(if (<= phi1 8.5e-9)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda2) (sin phi1))))
(atan2 (* (cos phi2) t_3) (- t_0 (* t_2 (expm1 (log1p t_1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos((lambda1 - lambda2));
double t_3 = sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -0.00014) {
tmp = atan2((cos(phi2) * log1p(expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 8.5e-9) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * sin(phi1))));
} else {
tmp = atan2((cos(phi2) * t_3), (t_0 - (t_2 * expm1(log1p(t_1)))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos((lambda1 - lambda2));
double t_3 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -0.00014) {
tmp = Math.atan2((Math.cos(phi2) * Math.log1p(Math.expm1(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 8.5e-9) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * Math.sin(phi1))));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_3), (t_0 - (t_2 * Math.expm1(Math.log1p(t_1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos((lambda1 - lambda2)) t_3 = math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -0.00014: tmp = math.atan2((math.cos(phi2) * math.log1p(math.expm1(t_3))), (t_0 - (t_1 * t_2))) elif phi1 <= 8.5e-9: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (math.cos(lambda2) * math.sin(phi1)))) else: tmp = math.atan2((math.cos(phi2) * t_3), (t_0 - (t_2 * math.expm1(math.log1p(t_1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = cos(Float64(lambda1 - lambda2)) t_3 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -0.00014) tmp = atan(Float64(cos(phi2) * log1p(expm1(t_3))), Float64(t_0 - Float64(t_1 * t_2))); elseif (phi1 <= 8.5e-9) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda2) * sin(phi1)))); else tmp = atan(Float64(cos(phi2) * t_3), Float64(t_0 - Float64(t_2 * expm1(log1p(t_1))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -0.00014], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Log[1 + N[(Exp[t$95$3] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 8.5e-9], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_3 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -0.00014:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_3\right)\right)}{t\_0 - t\_1 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_3}{t\_0 - t\_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -1.3999999999999999e-4Initial program 79.4%
log1p-expm1-u79.5%
Applied egg-rr79.5%
if -1.3999999999999999e-4 < phi1 < 8.5e-9Initial program 85.6%
sin-diff99.6%
sub-neg99.6%
Applied egg-rr99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in lambda1 around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in phi2 around 0 99.4%
if 8.5e-9 < phi1 Initial program 75.4%
expm1-log1p-u75.4%
Applied egg-rr75.4%
Final simplification87.4%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (expm1 (log1p (* (cos phi2) (sin (- lambda1 lambda2))))) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(expm1(log1p((cos(phi2) * sin((lambda1 - lambda2))))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.expm1(Math.log1p((Math.cos(phi2) * Math.sin((lambda1 - lambda2))))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.expm1(math.log1p((math.cos(phi2) * math.sin((lambda1 - lambda2))))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(expm1(log1p(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(Exp[N[Log[1 + N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.0%
sin-diff89.1%
sub-neg89.1%
Applied egg-rr89.1%
sub-neg89.1%
Simplified89.1%
sin-diff81.0%
expm1-log1p-u81.0%
expm1-undefine62.5%
*-commutative62.5%
Applied egg-rr62.5%
expm1-define81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (* (cos phi1) (sin phi2)) (* (cos (- lambda1 lambda2)) (expm1 (log1p (* (cos phi2) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos((lambda1 - lambda2)) * expm1(log1p((cos(phi2) * sin(phi1)))))));
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos((lambda1 - lambda2)) * Math.expm1(Math.log1p((Math.cos(phi2) * Math.sin(phi1)))))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos((lambda1 - lambda2)) * math.expm1(math.log1p((math.cos(phi2) * math.sin(phi1)))))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(Float64(lambda1 - lambda2)) * expm1(log1p(Float64(cos(phi2) * sin(phi1))))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(Exp[N[Log[1 + N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\cos \phi_2 \cdot \sin \phi_1\right)\right)}
\end{array}
Initial program 81.0%
expm1-log1p-u81.0%
Applied egg-rr81.0%
Final simplification81.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda1 -6.4e-25) (not (<= lambda1 8e-17)))
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))
(atan2 (* (sin lambda2) (- (cos phi2))) (- t_0 (* (cos lambda2) t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda1 <= -6.4e-25) || !(lambda1 <= 8e-17)) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
} else {
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
if ((lambda1 <= (-6.4d-25)) .or. (.not. (lambda1 <= 8d-17))) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))))
else
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda1 <= -6.4e-25) || !(lambda1 <= 8e-17)) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - (t_1 * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2((Math.sin(lambda2) * -Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda1 <= -6.4e-25) or not (lambda1 <= 8e-17): tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - (t_1 * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2((math.sin(lambda2) * -math.cos(phi2)), (t_0 - (math.cos(lambda2) * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda1 <= -6.4e-25) || !(lambda1 <= 8e-17)) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), Float64(t_0 - Float64(cos(lambda2) * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda1 <= -6.4e-25) || ~((lambda1 <= 8e-17))) tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2))))); else tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -6.4e-25], N[Not[LessEqual[lambda1, 8e-17]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_1 \leq -6.4 \cdot 10^{-25} \lor \neg \left(\lambda_1 \leq 8 \cdot 10^{-17}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_2 \cdot \left(-\cos \phi_2\right)}{t\_0 - \cos \lambda_2 \cdot t\_1}\\
\end{array}
\end{array}
if lambda1 < -6.4000000000000002e-25 or 8.00000000000000057e-17 < lambda1 Initial program 64.2%
Taylor expanded in lambda2 around 0 62.6%
if -6.4000000000000002e-25 < lambda1 < 8.00000000000000057e-17Initial program 99.8%
sin-diff99.8%
sub-neg99.8%
Applied egg-rr99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in lambda1 around 0 99.8%
cos-neg99.8%
Simplified99.8%
Taylor expanded in lambda1 around 0 86.4%
associate-*r*86.4%
mul-1-neg86.4%
Simplified86.4%
Final simplification73.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda2 -9.5e+23) (not (<= lambda2 3.5e+18)))
(atan2 (* (sin lambda2) (- (cos phi2))) (- t_0 (* (cos lambda2) t_1)))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos lambda1) t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.5e+18)) {
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1)));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
if ((lambda2 <= (-9.5d+23)) .or. (.not. (lambda2 <= 3.5d+18))) then
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1)))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.5e+18)) {
tmp = Math.atan2((Math.sin(lambda2) * -Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * t_1)));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(lambda1) * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda2 <= -9.5e+23) or not (lambda2 <= 3.5e+18): tmp = math.atan2((math.sin(lambda2) * -math.cos(phi2)), (t_0 - (math.cos(lambda2) * t_1))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(lambda1) * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.5e+18)) tmp = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), Float64(t_0 - Float64(cos(lambda2) * t_1))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(lambda1) * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda2 <= -9.5e+23) || ~((lambda2 <= 3.5e+18))) tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * t_1))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda2, -9.5e+23], N[Not[LessEqual[lambda2, 3.5e+18]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_2 \leq -9.5 \cdot 10^{+23} \lor \neg \left(\lambda_2 \leq 3.5 \cdot 10^{+18}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_2 \cdot \left(-\cos \phi_2\right)}{t\_0 - \cos \lambda_2 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \cos \lambda_1 \cdot t\_1}\\
\end{array}
\end{array}
if lambda2 < -9.50000000000000038e23 or 3.5e18 < lambda2 Initial program 63.5%
sin-diff79.1%
sub-neg79.1%
Applied egg-rr79.1%
sub-neg79.1%
Simplified79.1%
Taylor expanded in lambda1 around 0 79.2%
cos-neg79.2%
Simplified79.2%
Taylor expanded in lambda1 around 0 63.5%
associate-*r*63.5%
mul-1-neg63.5%
Simplified63.5%
if -9.50000000000000038e23 < lambda2 < 3.5e18Initial program 95.8%
Taylor expanded in lambda2 around 0 95.7%
Final simplification81.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_2 (* (cos phi1) (sin phi2))))
(if (<= lambda1 -0.044)
(atan2
(* (sin lambda1) (cos phi2))
(- t_2 (* t_0 (cos (- lambda1 lambda2)))))
(if (<= lambda1 3.6e-7)
(atan2 t_1 (- t_2 (* (cos lambda2) t_0)))
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double t_2 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -0.044) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 3.6e-7) {
tmp = atan2(t_1, (t_2 - (cos(lambda2) * t_0)));
} else {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi2) * sin(phi1)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
t_2 = cos(phi1) * sin(phi2)
if (lambda1 <= (-0.044d0)) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))))
else if (lambda1 <= 3.6d-7) then
tmp = atan2(t_1, (t_2 - (cos(lambda2) * t_0)))
else
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi2) * Math.sin(phi1);
double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double t_2 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -0.044) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_2 - (t_0 * Math.cos((lambda1 - lambda2)))));
} else if (lambda1 <= 3.6e-7) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda2) * t_0)));
} else {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin(phi1) t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2)) t_2 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -0.044: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_2 - (t_0 * math.cos((lambda1 - lambda2))))) elif lambda1 <= 3.6e-7: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda2) * t_0))) else: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_2 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -0.044) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_2 - Float64(t_0 * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 3.6e-7) tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda2) * t_0))); else tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin(phi1); t_1 = cos(phi2) * sin((lambda1 - lambda2)); t_2 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -0.044) tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2))))); elseif (lambda1 <= 3.6e-7) tmp = atan2(t_1, (t_2 - (cos(lambda2) * t_0))); else tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -0.044], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(t$95$0 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 3.6e-7], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.044:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_2 - t\_0 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 3.6 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_2 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\end{array}
\end{array}
if lambda1 < -0.043999999999999997Initial program 59.7%
Taylor expanded in lambda2 around 0 60.1%
if -0.043999999999999997 < lambda1 < 3.59999999999999994e-7Initial program 99.4%
Taylor expanded in lambda1 around 0 99.4%
cos-neg99.5%
Simplified99.4%
if 3.59999999999999994e-7 < lambda1 Initial program 64.1%
Taylor expanded in lambda2 around 0 64.1%
Final simplification81.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))))
(if (or (<= lambda2 -9.5e+23) (not (<= lambda2 3.15e+18)))
(atan2
(* (sin lambda2) (- (cos phi2)))
(- t_0 (* (cos lambda2) (* (cos phi2) (sin phi1)))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos lambda1) (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double tmp;
if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.15e+18)) {
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1)))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
if ((lambda2 <= (-9.5d+23)) .or. (.not. (lambda2 <= 3.15d+18))) then
tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1)))))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.15e+18)) {
tmp = Math.atan2((Math.sin(lambda2) * -Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * (Math.cos(phi2) * Math.sin(phi1)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(lambda1) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) tmp = 0 if (lambda2 <= -9.5e+23) or not (lambda2 <= 3.15e+18): tmp = math.atan2((math.sin(lambda2) * -math.cos(phi2)), (t_0 - (math.cos(lambda2) * (math.cos(phi2) * math.sin(phi1))))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(lambda1) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if ((lambda2 <= -9.5e+23) || !(lambda2 <= 3.15e+18)) tmp = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), Float64(t_0 - Float64(cos(lambda2) * Float64(cos(phi2) * sin(phi1))))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(lambda1) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); tmp = 0.0; if ((lambda2 <= -9.5e+23) || ~((lambda2 <= 3.15e+18))) tmp = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1))))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda1) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda2, -9.5e+23], N[Not[LessEqual[lambda2, 3.15e+18]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_2 \leq -9.5 \cdot 10^{+23} \lor \neg \left(\lambda_2 \leq 3.15 \cdot 10^{+18}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_2 \cdot \left(-\cos \phi_2\right)}{t\_0 - \cos \lambda_2 \cdot \left(\cos \phi_2 \cdot \sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \cos \lambda_1 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda2 < -9.50000000000000038e23 or 3.15e18 < lambda2 Initial program 63.5%
sin-diff79.1%
sub-neg79.1%
Applied egg-rr79.1%
sub-neg79.1%
Simplified79.1%
Taylor expanded in lambda1 around 0 79.2%
cos-neg79.2%
Simplified79.2%
Taylor expanded in lambda1 around 0 63.5%
associate-*r*63.5%
mul-1-neg63.5%
Simplified63.5%
if -9.50000000000000038e23 < lambda2 < 3.15e18Initial program 95.8%
Taylor expanded in phi2 around 0 80.5%
Taylor expanded in lambda2 around 0 80.5%
Final simplification72.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -7.5e-6) (not (<= phi2 6.2e-8)))
(atan2 (* (cos phi2) t_1) (- t_0 (* (cos phi2) (sin phi1))))
(atan2
(expm1 (log1p t_1))
(- t_0 (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) {
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))));
} else {
tmp = atan2(expm1(log1p(t_1)), (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) {
tmp = Math.atan2((Math.cos(phi2) * t_1), (t_0 - (Math.cos(phi2) * Math.sin(phi1))));
} else {
tmp = Math.atan2(Math.expm1(Math.log1p(t_1)), (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -7.5e-6) or not (phi2 <= 6.2e-8): tmp = math.atan2((math.cos(phi2) * t_1), (t_0 - (math.cos(phi2) * math.sin(phi1)))) else: tmp = math.atan2(math.expm1(math.log1p(t_1)), (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) tmp = atan(Float64(cos(phi2) * t_1), Float64(t_0 - Float64(cos(phi2) * sin(phi1)))); else tmp = atan(expm1(log1p(t_1)), Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -7.5e-6], N[Not[LessEqual[phi2, 6.2e-8]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -7.5 \cdot 10^{-6} \lor \neg \left(\phi_2 \leq 6.2 \cdot 10^{-8}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 - \cos \phi_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -7.50000000000000019e-6 or 6.2e-8 < phi2 Initial program 78.2%
Taylor expanded in lambda2 around 0 65.5%
Taylor expanded in lambda1 around 0 60.9%
if -7.50000000000000019e-6 < phi2 < 6.2e-8Initial program 83.9%
Taylor expanded in phi2 around 0 83.9%
Taylor expanded in phi2 around 0 83.9%
expm1-log1p-u83.9%
expm1-undefine65.3%
Applied egg-rr65.3%
expm1-define83.9%
Simplified83.9%
Final simplification72.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -7.5e-6) (not (<= phi2 4.9e-8)))
(atan2 (* (cos phi2) t_1) (- t_0 (* (cos phi2) (sin phi1))))
(atan2
t_1
(- t_0 (* (sin phi1) (log1p (expm1 (cos (- lambda1 lambda2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 4.9e-8)) {
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))));
} else {
tmp = atan2(t_1, (t_0 - (sin(phi1) * log1p(expm1(cos((lambda1 - lambda2)))))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 4.9e-8)) {
tmp = Math.atan2((Math.cos(phi2) * t_1), (t_0 - (Math.cos(phi2) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.sin(phi1) * Math.log1p(Math.expm1(Math.cos((lambda1 - lambda2)))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -7.5e-6) or not (phi2 <= 4.9e-8): tmp = math.atan2((math.cos(phi2) * t_1), (t_0 - (math.cos(phi2) * math.sin(phi1)))) else: tmp = math.atan2(t_1, (t_0 - (math.sin(phi1) * math.log1p(math.expm1(math.cos((lambda1 - lambda2))))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -7.5e-6) || !(phi2 <= 4.9e-8)) tmp = atan(Float64(cos(phi2) * t_1), Float64(t_0 - Float64(cos(phi2) * sin(phi1)))); else tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * log1p(expm1(cos(Float64(lambda1 - lambda2))))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -7.5e-6], N[Not[LessEqual[phi2, 4.9e-8]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Log[1 + N[(Exp[N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -7.5 \cdot 10^{-6} \lor \neg \left(\phi_2 \leq 4.9 \cdot 10^{-8}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 - \cos \phi_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\\
\end{array}
\end{array}
if phi2 < -7.50000000000000019e-6 or 4.9000000000000002e-8 < phi2 Initial program 78.2%
Taylor expanded in lambda2 around 0 65.5%
Taylor expanded in lambda1 around 0 60.9%
if -7.50000000000000019e-6 < phi2 < 4.9000000000000002e-8Initial program 83.9%
Taylor expanded in phi2 around 0 83.9%
Taylor expanded in phi2 around 0 83.9%
log1p-expm1-u83.9%
Applied egg-rr83.9%
Final simplification72.4%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.0%
Final simplification81.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -0.0025) (not (<= phi2 0.115)))
(atan2 (* (cos phi2) t_1) (- t_0 (* (cos phi2) (sin phi1))))
(atan2
(* t_1 (+ 1.0 (* -0.5 (pow phi2 2.0))))
(- t_0 (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.0025) || !(phi2 <= 0.115)) {
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))));
} else {
tmp = atan2((t_1 * (1.0 + (-0.5 * pow(phi2, 2.0)))), (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = sin((lambda1 - lambda2))
if ((phi2 <= (-0.0025d0)) .or. (.not. (phi2 <= 0.115d0))) then
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))))
else
tmp = atan2((t_1 * (1.0d0 + ((-0.5d0) * (phi2 ** 2.0d0)))), (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.0025) || !(phi2 <= 0.115)) {
tmp = Math.atan2((Math.cos(phi2) * t_1), (t_0 - (Math.cos(phi2) * Math.sin(phi1))));
} else {
tmp = Math.atan2((t_1 * (1.0 + (-0.5 * Math.pow(phi2, 2.0)))), (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -0.0025) or not (phi2 <= 0.115): tmp = math.atan2((math.cos(phi2) * t_1), (t_0 - (math.cos(phi2) * math.sin(phi1)))) else: tmp = math.atan2((t_1 * (1.0 + (-0.5 * math.pow(phi2, 2.0)))), (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -0.0025) || !(phi2 <= 0.115)) tmp = atan(Float64(cos(phi2) * t_1), Float64(t_0 - Float64(cos(phi2) * sin(phi1)))); else tmp = atan(Float64(t_1 * Float64(1.0 + Float64(-0.5 * (phi2 ^ 2.0)))), Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -0.0025) || ~((phi2 <= 0.115))) tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1)))); else tmp = atan2((t_1 * (1.0 + (-0.5 * (phi2 ^ 2.0)))), (t_0 - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -0.0025], N[Not[LessEqual[phi2, 0.115]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(t$95$1 * N[(1.0 + N[(-0.5 * N[Power[phi2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.0025 \lor \neg \left(\phi_2 \leq 0.115\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 - \cos \phi_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1 \cdot \left(1 + -0.5 \cdot {\phi_2}^{2}\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -0.00250000000000000005 or 0.115000000000000005 < phi2 Initial program 78.2%
Taylor expanded in lambda2 around 0 65.1%
Taylor expanded in lambda1 around 0 60.1%
if -0.00250000000000000005 < phi2 < 0.115000000000000005Initial program 83.6%
Taylor expanded in phi2 around 0 83.6%
Taylor expanded in phi2 around 0 83.6%
*-lft-identity83.6%
associate-*r*83.6%
distribute-rgt-out83.6%
Simplified83.6%
Final simplification72.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (or (<= phi2 -0.055) (not (<= phi2 6.2e-8)))
(atan2 t_1 (- t_0 (* (cos phi2) (sin phi1))))
(atan2 t_1 (- t_0 (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.055) || !(phi2 <= 6.2e-8)) {
tmp = atan2(t_1, (t_0 - (cos(phi2) * sin(phi1))));
} else {
tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
if ((phi2 <= (-0.055d0)) .or. (.not. (phi2 <= 6.2d-8))) then
tmp = atan2(t_1, (t_0 - (cos(phi2) * sin(phi1))))
else
tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.055) || !(phi2 <= 6.2e-8)) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(phi2) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -0.055) or not (phi2 <= 6.2e-8): tmp = math.atan2(t_1, (t_0 - (math.cos(phi2) * math.sin(phi1)))) else: tmp = math.atan2(t_1, (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if ((phi2 <= -0.055) || !(phi2 <= 6.2e-8)) tmp = atan(t_1, Float64(t_0 - Float64(cos(phi2) * sin(phi1)))); else tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -0.055) || ~((phi2 <= 6.2e-8))) tmp = atan2(t_1, (t_0 - (cos(phi2) * sin(phi1)))); else tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -0.055], N[Not[LessEqual[phi2, 6.2e-8]], $MachinePrecision]], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.055 \lor \neg \left(\phi_2 \leq 6.2 \cdot 10^{-8}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \phi_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -0.0550000000000000003 or 6.2e-8 < phi2 Initial program 78.3%
Taylor expanded in lambda2 around 0 65.6%
Taylor expanded in lambda1 around 0 60.8%
if -0.0550000000000000003 < phi2 < 6.2e-8Initial program 83.7%
Taylor expanded in phi2 around 0 83.7%
Final simplification72.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -7.5e-6) (not (<= phi2 6.2e-8)))
(atan2 (* (cos phi2) t_1) (- t_0 (* (cos phi2) (sin phi1))))
(atan2 t_1 (- t_0 (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) {
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))));
} else {
tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = sin((lambda1 - lambda2))
if ((phi2 <= (-7.5d-6)) .or. (.not. (phi2 <= 6.2d-8))) then
tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1))))
else
tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) {
tmp = Math.atan2((Math.cos(phi2) * t_1), (t_0 - (Math.cos(phi2) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -7.5e-6) or not (phi2 <= 6.2e-8): tmp = math.atan2((math.cos(phi2) * t_1), (t_0 - (math.cos(phi2) * math.sin(phi1)))) else: tmp = math.atan2(t_1, (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -7.5e-6) || !(phi2 <= 6.2e-8)) tmp = atan(Float64(cos(phi2) * t_1), Float64(t_0 - Float64(cos(phi2) * sin(phi1)))); else tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -7.5e-6) || ~((phi2 <= 6.2e-8))) tmp = atan2((cos(phi2) * t_1), (t_0 - (cos(phi2) * sin(phi1)))); else tmp = atan2(t_1, (t_0 - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -7.5e-6], N[Not[LessEqual[phi2, 6.2e-8]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -7.5 \cdot 10^{-6} \lor \neg \left(\phi_2 \leq 6.2 \cdot 10^{-8}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 - \cos \phi_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -7.50000000000000019e-6 or 6.2e-8 < phi2 Initial program 78.2%
Taylor expanded in lambda2 around 0 65.5%
Taylor expanded in lambda1 around 0 60.9%
if -7.50000000000000019e-6 < phi2 < 6.2e-8Initial program 83.9%
Taylor expanded in phi2 around 0 83.9%
Taylor expanded in phi2 around 0 83.9%
Final simplification72.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (sin (- lambda1 lambda2))))
(if (or (<= phi1 -0.00023) (not (<= phi1 980000000.0)))
(atan2 t_2 (- t_0 (* (sin phi1) t_1)))
(atan2 (* (cos phi2) t_2) (- t_0 (* phi1 t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = sin((lambda1 - lambda2));
double tmp;
if ((phi1 <= -0.00023) || !(phi1 <= 980000000.0)) {
tmp = atan2(t_2, (t_0 - (sin(phi1) * t_1)));
} else {
tmp = atan2((cos(phi2) * t_2), (t_0 - (phi1 * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
t_2 = sin((lambda1 - lambda2))
if ((phi1 <= (-0.00023d0)) .or. (.not. (phi1 <= 980000000.0d0))) then
tmp = atan2(t_2, (t_0 - (sin(phi1) * t_1)))
else
tmp = atan2((cos(phi2) * t_2), (t_0 - (phi1 * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos((lambda1 - lambda2));
double t_2 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi1 <= -0.00023) || !(phi1 <= 980000000.0)) {
tmp = Math.atan2(t_2, (t_0 - (Math.sin(phi1) * t_1)));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_2), (t_0 - (phi1 * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos((lambda1 - lambda2)) t_2 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi1 <= -0.00023) or not (phi1 <= 980000000.0): tmp = math.atan2(t_2, (t_0 - (math.sin(phi1) * t_1))) else: tmp = math.atan2((math.cos(phi2) * t_2), (t_0 - (phi1 * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi1 <= -0.00023) || !(phi1 <= 980000000.0)) tmp = atan(t_2, Float64(t_0 - Float64(sin(phi1) * t_1))); else tmp = atan(Float64(cos(phi2) * t_2), Float64(t_0 - Float64(phi1 * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos((lambda1 - lambda2)); t_2 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi1 <= -0.00023) || ~((phi1 <= 980000000.0))) tmp = atan2(t_2, (t_0 - (sin(phi1) * t_1))); else tmp = atan2((cos(phi2) * t_2), (t_0 - (phi1 * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi1, -0.00023], N[Not[LessEqual[phi1, 980000000.0]], $MachinePrecision]], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] / N[(t$95$0 - N[(phi1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -0.00023 \lor \neg \left(\phi_1 \leq 980000000\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \sin \phi_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_2}{t\_0 - \phi_1 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -2.3000000000000001e-4 or 9.8e8 < phi1 Initial program 76.6%
Taylor expanded in phi2 around 0 51.8%
Taylor expanded in phi2 around 0 48.1%
if -2.3000000000000001e-4 < phi1 < 9.8e8Initial program 86.0%
Taylor expanded in phi2 around 0 85.1%
Taylor expanded in phi1 around 0 85.1%
Final simplification65.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2))))))
(if (<= phi2 3e+92)
(atan2 (sin (- lambda1 lambda2)) t_0)
(atan2 (* (cos phi2) (- lambda1 lambda2)) t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= 3e+92) {
tmp = atan2(sin((lambda1 - lambda2)), t_0);
} else {
tmp = atan2((cos(phi2) * (lambda1 - lambda2)), t_0);
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = (cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))
if (phi2 <= 3d+92) then
tmp = atan2(sin((lambda1 - lambda2)), t_0)
else
tmp = atan2((cos(phi2) * (lambda1 - lambda2)), t_0)
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= 3e+92) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), t_0);
} else {
tmp = Math.atan2((Math.cos(phi2) * (lambda1 - lambda2)), t_0);
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = (math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))) tmp = 0 if phi2 <= 3e+92: tmp = math.atan2(math.sin((lambda1 - lambda2)), t_0) else: tmp = math.atan2((math.cos(phi2) * (lambda1 - lambda2)), t_0) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= 3e+92) tmp = atan(sin(Float64(lambda1 - lambda2)), t_0); else tmp = atan(Float64(cos(phi2) * Float64(lambda1 - lambda2)), t_0); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = (cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))); tmp = 0.0; if (phi2 <= 3e+92) tmp = atan2(sin((lambda1 - lambda2)), t_0); else tmp = atan2((cos(phi2) * (lambda1 - lambda2)), t_0); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, 3e+92], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / t$95$0], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] / t$95$0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 3 \cdot 10^{+92}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 - \lambda_2\right)}{t\_0}\\
\end{array}
\end{array}
if phi2 < 3.00000000000000013e92Initial program 81.9%
Taylor expanded in phi2 around 0 71.7%
Taylor expanded in phi2 around 0 59.6%
if 3.00000000000000013e92 < phi2 Initial program 77.1%
Taylor expanded in phi2 around 0 48.9%
Taylor expanded in lambda1 around 0 36.9%
+-commutative36.9%
sin-neg36.9%
unsub-neg36.9%
cos-neg36.9%
Simplified36.9%
Taylor expanded in lambda2 around 0 24.9%
+-commutative24.9%
associate-*r*24.9%
neg-mul-124.9%
distribute-rgt-out24.9%
sub-neg24.9%
Simplified24.9%
Final simplification53.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.0%
Taylor expanded in phi2 around 0 67.5%
Taylor expanded in phi2 around 0 51.3%
Final simplification51.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 11000.0)
(atan2
(sin (- lambda1 lambda2))
(- phi2 (* (sin phi1) (cos (- lambda2 lambda1)))))
(atan2
(sin (- lambda2))
(- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 11000.0) {
tmp = atan2(sin((lambda1 - lambda2)), (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))));
} else {
tmp = atan2(sin(-lambda2), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi2 <= 11000.0d0) then
tmp = atan2(sin((lambda1 - lambda2)), (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))))
else
tmp = atan2(sin(-lambda2), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 11000.0) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (phi2 - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
} else {
tmp = Math.atan2(Math.sin(-lambda2), (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 11000.0: tmp = math.atan2(math.sin((lambda1 - lambda2)), (phi2 - (math.sin(phi1) * math.cos((lambda2 - lambda1))))) else: tmp = math.atan2(math.sin(-lambda2), (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 11000.0) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1))))); else tmp = atan(sin(Float64(-lambda2)), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 11000.0) tmp = atan2(sin((lambda1 - lambda2)), (phi2 - (sin(phi1) * cos((lambda2 - lambda1))))); else tmp = atan2(sin(-lambda2), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 11000.0], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[(-lambda2)], $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 11000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right)}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < 11000Initial program 82.5%
Taylor expanded in phi2 around 0 72.9%
Taylor expanded in phi2 around 0 61.9%
Taylor expanded in phi1 around 0 61.4%
Taylor expanded in phi2 around 0 60.9%
mul-1-neg60.9%
*-commutative60.9%
unsub-neg60.9%
sub-neg60.9%
neg-mul-160.9%
neg-mul-160.9%
remove-double-neg60.9%
distribute-neg-in60.9%
+-commutative60.9%
neg-mul-160.9%
cos-neg60.9%
neg-mul-160.9%
sub-neg60.9%
Simplified60.9%
if 11000 < phi2 Initial program 76.1%
Taylor expanded in phi2 around 0 49.6%
Taylor expanded in phi2 around 0 16.1%
Taylor expanded in phi1 around 0 15.0%
Taylor expanded in lambda1 around 0 16.2%
Final simplification50.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 6800.0)
(atan2 t_0 (- phi2 (* (sin phi1) (cos (- lambda2 lambda1)))))
(atan2 t_0 (- (sin phi2) (* (cos lambda1) (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 6800.0) {
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))));
} else {
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if (phi2 <= 6800.0d0) then
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))))
else
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 6800.0) {
tmp = Math.atan2(t_0, (phi2 - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos(lambda1) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= 6800.0: tmp = math.atan2(t_0, (phi2 - (math.sin(phi1) * math.cos((lambda2 - lambda1))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos(lambda1) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= 6800.0) tmp = atan(t_0, Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(lambda1) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 6800.0) tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1))))); else tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 6800.0], N[ArcTan[t$95$0 / N[(phi2 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 6800:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \lambda_1 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if phi2 < 6800Initial program 82.5%
Taylor expanded in phi2 around 0 72.9%
Taylor expanded in phi2 around 0 61.9%
Taylor expanded in phi1 around 0 61.4%
Taylor expanded in phi2 around 0 60.9%
mul-1-neg60.9%
*-commutative60.9%
unsub-neg60.9%
sub-neg60.9%
neg-mul-160.9%
neg-mul-160.9%
remove-double-neg60.9%
distribute-neg-in60.9%
+-commutative60.9%
neg-mul-160.9%
cos-neg60.9%
neg-mul-160.9%
sub-neg60.9%
Simplified60.9%
if 6800 < phi2 Initial program 76.1%
Taylor expanded in phi2 around 0 49.6%
Taylor expanded in phi2 around 0 16.1%
Taylor expanded in phi1 around 0 15.0%
Taylor expanded in lambda2 around 0 15.0%
Final simplification50.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.0%
Taylor expanded in phi2 around 0 67.5%
Taylor expanded in phi2 around 0 51.3%
Taylor expanded in phi1 around 0 50.7%
Final simplification50.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 370000.0)
(atan2 t_0 (- phi2 (* (sin phi1) (cos (- lambda2 lambda1)))))
(atan2 t_0 (sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 370000.0) {
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))));
} else {
tmp = atan2(t_0, sin(phi2));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if (phi2 <= 370000.0d0) then
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1)))))
else
tmp = atan2(t_0, sin(phi2))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 370000.0) {
tmp = Math.atan2(t_0, (phi2 - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
} else {
tmp = Math.atan2(t_0, Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= 370000.0: tmp = math.atan2(t_0, (phi2 - (math.sin(phi1) * math.cos((lambda2 - lambda1))))) else: tmp = math.atan2(t_0, math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= 370000.0) tmp = atan(t_0, Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1))))); else tmp = atan(t_0, sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 370000.0) tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda2 - lambda1))))); else tmp = atan2(t_0, sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 370000.0], N[ArcTan[t$95$0 / N[(phi2 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 370000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 3.7e5Initial program 82.5%
Taylor expanded in phi2 around 0 72.9%
Taylor expanded in phi2 around 0 61.9%
Taylor expanded in phi1 around 0 61.4%
Taylor expanded in phi2 around 0 60.9%
mul-1-neg60.9%
*-commutative60.9%
unsub-neg60.9%
sub-neg60.9%
neg-mul-160.9%
neg-mul-160.9%
remove-double-neg60.9%
distribute-neg-in60.9%
+-commutative60.9%
neg-mul-160.9%
cos-neg60.9%
neg-mul-160.9%
sub-neg60.9%
Simplified60.9%
if 3.7e5 < phi2 Initial program 76.1%
Taylor expanded in phi2 around 0 49.6%
Taylor expanded in phi2 around 0 16.1%
Taylor expanded in phi1 around 0 15.0%
Taylor expanded in phi1 around 0 13.0%
Final simplification49.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (* (cos (- lambda2 lambda1)) (- (sin phi1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (cos((lambda2 - lambda1)) * -sin(phi1)));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), (cos((lambda2 - lambda1)) * -sin(phi1)))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), (Math.cos((lambda2 - lambda1)) * -Math.sin(phi1)));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (math.cos((lambda2 - lambda1)) * -math.sin(phi1)))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(cos(Float64(lambda2 - lambda1)) * Float64(-sin(phi1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (cos((lambda2 - lambda1)) * -sin(phi1))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \left(\lambda_2 - \lambda_1\right) \cdot \left(-\sin \phi_1\right)}
\end{array}
Initial program 81.0%
Taylor expanded in phi2 around 0 67.5%
Taylor expanded in phi2 around 0 51.3%
Taylor expanded in phi1 around 0 50.7%
Taylor expanded in phi2 around 0 46.9%
*-commutative46.9%
neg-mul-146.9%
sub-neg46.9%
neg-mul-146.9%
neg-mul-146.9%
remove-double-neg46.9%
distribute-neg-in46.9%
+-commutative46.9%
neg-mul-146.9%
cos-neg46.9%
neg-mul-146.9%
sub-neg46.9%
distribute-rgt-neg-in46.9%
Simplified46.9%
Final simplification46.9%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), sin(phi2));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
\end{array}
Initial program 81.0%
Taylor expanded in phi2 around 0 67.5%
Taylor expanded in phi2 around 0 51.3%
Taylor expanded in phi1 around 0 50.7%
Taylor expanded in phi1 around 0 32.6%
Final simplification32.6%
herbie shell --seed 2024044
(FPCore (lambda1 lambda2 phi1 phi2)
:name "Bearing on a great circle"
:precision binary64
(atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))