
(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 34 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 lambda2) (cos lambda1) (* (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(lambda2), cos(lambda1), (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(Float64(cos(phi2) * sin(phi1)) * fma(cos(lambda2), cos(lambda1), 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[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $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 \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \sin \lambda_2\right)}
\end{array}
Initial program 78.9%
sin-diff88.9%
Applied egg-rr88.9%
cos-diff99.7%
*-commutative99.7%
Applied egg-rr99.7%
fma-def99.7%
Simplified99.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 78.9%
sin-diff88.9%
Applied egg-rr88.9%
cos-diff65.7%
+-commutative65.7%
*-commutative65.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda1) (sin lambda2)))
(t_1 (* (sin lambda1) (cos lambda2)))
(t_2 (* (cos phi2) (sin phi1))))
(if (or (<= phi2 -0.078) (not (<= phi2 5e-35)))
(atan2
(* (cos phi2) (- t_1 (expm1 (log1p t_0))))
(- (* (cos phi1) (sin phi2)) (* t_2 (cos (- lambda1 lambda2)))))
(atan2
(* (- t_1 t_0) (cos phi2))
(-
(* phi2 (cos phi1))
(*
t_2
(+
(* (sin lambda1) (sin lambda2))
(* (cos lambda2) (cos lambda1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda1) * sin(lambda2);
double t_1 = sin(lambda1) * cos(lambda2);
double t_2 = cos(phi2) * sin(phi1);
double tmp;
if ((phi2 <= -0.078) || !(phi2 <= 5e-35)) {
tmp = atan2((cos(phi2) * (t_1 - expm1(log1p(t_0)))), ((cos(phi1) * sin(phi2)) - (t_2 * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(((t_1 - t_0) * cos(phi2)), ((phi2 * cos(phi1)) - (t_2 * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(lambda1) * Math.sin(lambda2);
double t_1 = Math.sin(lambda1) * Math.cos(lambda2);
double t_2 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((phi2 <= -0.078) || !(phi2 <= 5e-35)) {
tmp = Math.atan2((Math.cos(phi2) * (t_1 - Math.expm1(Math.log1p(t_0)))), ((Math.cos(phi1) * Math.sin(phi2)) - (t_2 * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(((t_1 - t_0) * Math.cos(phi2)), ((phi2 * Math.cos(phi1)) - (t_2 * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(lambda1) * math.sin(lambda2) t_1 = math.sin(lambda1) * math.cos(lambda2) t_2 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (phi2 <= -0.078) or not (phi2 <= 5e-35): tmp = math.atan2((math.cos(phi2) * (t_1 - math.expm1(math.log1p(t_0)))), ((math.cos(phi1) * math.sin(phi2)) - (t_2 * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(((t_1 - t_0) * math.cos(phi2)), ((phi2 * math.cos(phi1)) - (t_2 * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda1) * sin(lambda2)) t_1 = Float64(sin(lambda1) * cos(lambda2)) t_2 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((phi2 <= -0.078) || !(phi2 <= 5e-35)) tmp = atan(Float64(cos(phi2) * Float64(t_1 - expm1(log1p(t_0)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_2 * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(Float64(t_1 - t_0) * cos(phi2)), Float64(Float64(phi2 * cos(phi1)) - Float64(t_2 * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -0.078], N[Not[LessEqual[phi2, 5e-35]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(t$95$1 - t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * 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}
\\
\begin{array}{l}
t_0 := \cos \lambda_1 \cdot \sin \lambda_2\\
t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\phi_2 \leq -0.078 \lor \neg \left(\phi_2 \leq 5 \cdot 10^{-35}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_1 - \mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - t\_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_1 - t\_0\right) \cdot \cos \phi_2}{\phi_2 \cdot \cos \phi_1 - t\_2 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\end{array}
\end{array}
if phi2 < -0.0779999999999999999 or 4.99999999999999964e-35 < phi2 Initial program 74.9%
sin-diff88.8%
Applied egg-rr88.8%
expm1-log1p-u88.8%
Applied egg-rr88.8%
if -0.0779999999999999999 < phi2 < 4.99999999999999964e-35Initial program 83.0%
sin-diff89.0%
Applied egg-rr89.0%
cos-diff82.8%
+-commutative82.8%
*-commutative82.8%
Applied egg-rr99.9%
Taylor expanded in phi2 around 0 99.4%
Final simplification94.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos lambda2)))
(t_1 (* (cos lambda1) (sin lambda2)))
(t_2 (* (cos phi1) (sin phi2))))
(if (or (<= phi2 -4.2e+35) (not (<= phi2 5e-40)))
(atan2
(* (cos phi2) (- t_0 (expm1 (log1p t_1))))
(- t_2 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
(* (- t_0 t_1) (cos phi2))
(-
t_2
(*
(sin phi1)
(+
(* (sin lambda1) (sin lambda2))
(* (cos lambda2) (cos lambda1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(lambda2);
double t_1 = cos(lambda1) * sin(lambda2);
double t_2 = cos(phi1) * sin(phi2);
double tmp;
if ((phi2 <= -4.2e+35) || !(phi2 <= 5e-40)) {
tmp = atan2((cos(phi2) * (t_0 - expm1(log1p(t_1)))), (t_2 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(((t_0 - t_1) * cos(phi2)), (t_2 - (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(lambda1) * Math.cos(lambda2);
double t_1 = Math.cos(lambda1) * Math.sin(lambda2);
double t_2 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if ((phi2 <= -4.2e+35) || !(phi2 <= 5e-40)) {
tmp = Math.atan2((Math.cos(phi2) * (t_0 - Math.expm1(Math.log1p(t_1)))), (t_2 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(((t_0 - t_1) * Math.cos(phi2)), (t_2 - (Math.sin(phi1) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(lambda2) t_1 = math.cos(lambda1) * math.sin(lambda2) t_2 = math.cos(phi1) * math.sin(phi2) tmp = 0 if (phi2 <= -4.2e+35) or not (phi2 <= 5e-40): tmp = math.atan2((math.cos(phi2) * (t_0 - math.expm1(math.log1p(t_1)))), (t_2 - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(((t_0 - t_1) * math.cos(phi2)), (t_2 - (math.sin(phi1) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(lambda2)) t_1 = Float64(cos(lambda1) * sin(lambda2)) t_2 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if ((phi2 <= -4.2e+35) || !(phi2 <= 5e-40)) tmp = atan(Float64(cos(phi2) * Float64(t_0 - expm1(log1p(t_1)))), Float64(t_2 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(Float64(t_0 - t_1) * cos(phi2)), Float64(t_2 - Float64(sin(phi1) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -4.2e+35], N[Not[LessEqual[phi2, 5e-40]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(t$95$0 - t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - 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]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_1 := \cos \lambda_1 \cdot \sin \lambda_2\\
t_2 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_2 \leq -4.2 \cdot 10^{+35} \lor \neg \left(\phi_2 \leq 5 \cdot 10^{-40}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)\right)}{t\_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_0 - t\_1\right) \cdot \cos \phi_2}{t\_2 - \sin \phi_1 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\end{array}
\end{array}
if phi2 < -4.1999999999999998e35 or 4.99999999999999965e-40 < phi2 Initial program 75.7%
sin-diff90.0%
Applied egg-rr90.0%
expm1-log1p-u90.0%
Applied egg-rr90.0%
if -4.1999999999999998e35 < phi2 < 4.99999999999999965e-40Initial program 81.8%
sin-diff87.8%
Applied egg-rr87.8%
cos-diff99.9%
*-commutative99.9%
Applied egg-rr99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in phi2 around 0 97.5%
Final simplification94.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos lambda2)))
(t_1 (* (cos lambda1) (sin lambda2))))
(if (or (<= phi2 -3.5e-7) (not (<= phi2 1.65e-33)))
(atan2
(* (cos phi2) (- t_0 (expm1 (log1p t_1))))
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
(* (- t_0 t_1) (cos phi2))
(-
(sin phi2)
(*
(sin phi1)
(+
(* (sin lambda1) (sin lambda2))
(* (cos lambda2) (cos lambda1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(lambda2);
double t_1 = cos(lambda1) * sin(lambda2);
double tmp;
if ((phi2 <= -3.5e-7) || !(phi2 <= 1.65e-33)) {
tmp = atan2((cos(phi2) * (t_0 - expm1(log1p(t_1)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(((t_0 - t_1) * cos(phi2)), (sin(phi2) - (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(lambda1) * Math.cos(lambda2);
double t_1 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if ((phi2 <= -3.5e-7) || !(phi2 <= 1.65e-33)) {
tmp = Math.atan2((Math.cos(phi2) * (t_0 - Math.expm1(Math.log1p(t_1)))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(((t_0 - t_1) * Math.cos(phi2)), (Math.sin(phi2) - (Math.sin(phi1) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(lambda2) t_1 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if (phi2 <= -3.5e-7) or not (phi2 <= 1.65e-33): tmp = math.atan2((math.cos(phi2) * (t_0 - math.expm1(math.log1p(t_1)))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(((t_0 - t_1) * math.cos(phi2)), (math.sin(phi2) - (math.sin(phi1) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(lambda2)) t_1 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if ((phi2 <= -3.5e-7) || !(phi2 <= 1.65e-33)) tmp = atan(Float64(cos(phi2) * Float64(t_0 - expm1(log1p(t_1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(Float64(t_0 - t_1) * cos(phi2)), Float64(sin(phi2) - Float64(sin(phi1) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -3.5e-7], N[Not[LessEqual[phi2, 1.65e-33]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[(Exp[N[Log[1 + t$95$1], $MachinePrecision]] - 1), $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], N[ArcTan[N[(N[(t$95$0 - t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_1 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_2 \leq -3.5 \cdot 10^{-7} \lor \neg \left(\phi_2 \leq 1.65 \cdot 10^{-33}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\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)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_0 - t\_1\right) \cdot \cos \phi_2}{\sin \phi_2 - \sin \phi_1 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\end{array}
\end{array}
if phi2 < -3.49999999999999984e-7 or 1.6500000000000001e-33 < phi2 Initial program 74.6%
sin-diff88.4%
Applied egg-rr88.4%
expm1-log1p-u88.4%
Applied egg-rr88.4%
if -3.49999999999999984e-7 < phi2 < 1.6500000000000001e-33Initial program 83.4%
*-commutative83.4%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in phi1 around 0 83.4%
Taylor expanded in phi2 around 0 83.4%
cos-diff83.7%
+-commutative83.7%
*-commutative83.7%
Applied egg-rr83.7%
sin-diff89.4%
Applied egg-rr99.5%
Final simplification93.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))))
(if (or (<= phi2 -3.5e-7) (not (<= phi2 1e-33)))
(atan2
t_0
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
t_0
(-
(sin phi2)
(*
(sin phi1)
(+
(* (sin lambda1) (sin lambda2))
(* (cos lambda2) (cos lambda1)))))))))
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 <= -3.5e-7) || !(phi2 <= 1e-33)) {
tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)
if ((phi2 <= (-3.5d-7)) .or. (.not. (phi2 <= 1d-33))) then
tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2);
double tmp;
if ((phi2 <= -3.5e-7) || !(phi2 <= 1e-33)) {
tmp = Math.atan2(t_0, ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.sin(phi1) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2) tmp = 0 if (phi2 <= -3.5e-7) or not (phi2 <= 1e-33): tmp = math.atan2(t_0, ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.sin(phi1) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1)))))) 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 <= -3.5e-7) || !(phi2 <= 1e-33)) 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(sin(phi1) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2); tmp = 0.0; if ((phi2 <= -3.5e-7) || ~((phi2 <= 1e-33))) tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); else tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1)))))); end tmp_2 = 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, -3.5e-7], N[Not[LessEqual[phi2, 1e-33]], $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[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]]]
\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 -3.5 \cdot 10^{-7} \lor \neg \left(\phi_2 \leq 10^{-33}\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 - \sin \phi_1 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\end{array}
\end{array}
if phi2 < -3.49999999999999984e-7 or 1.0000000000000001e-33 < phi2 Initial program 74.6%
sin-diff88.4%
Applied egg-rr88.4%
if -3.49999999999999984e-7 < phi2 < 1.0000000000000001e-33Initial program 83.4%
*-commutative83.4%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in phi1 around 0 83.4%
Taylor expanded in phi2 around 0 83.4%
cos-diff83.7%
+-commutative83.7%
*-commutative83.7%
Applied egg-rr83.7%
sin-diff89.4%
Applied egg-rr99.5%
Final simplification93.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda1 -7e-6) (not (<= lambda1 0.32)))
(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) (- -1.0 (* -0.5 (pow lambda1 2.0))))))
(- t_0 (* t_1 (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(phi1);
double tmp;
if ((lambda1 <= -7e-6) || !(lambda1 <= 0.32)) {
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) * (-1.0 - (-0.5 * pow(lambda1, 2.0)))))), (t_0 - (t_1 * 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(phi1)
if ((lambda1 <= (-7d-6)) .or. (.not. (lambda1 <= 0.32d0))) 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) * ((-1.0d0) - ((-0.5d0) * (lambda1 ** 2.0d0)))))), (t_0 - (t_1 * 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(phi1);
double tmp;
if ((lambda1 <= -7e-6) || !(lambda1 <= 0.32)) {
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) * (-1.0 - (-0.5 * Math.pow(lambda1, 2.0)))))), (t_0 - (t_1 * 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(phi1) tmp = 0 if (lambda1 <= -7e-6) or not (lambda1 <= 0.32): 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) * (-1.0 - (-0.5 * math.pow(lambda1, 2.0)))))), (t_0 - (t_1 * 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(phi1)) tmp = 0.0 if ((lambda1 <= -7e-6) || !(lambda1 <= 0.32)) 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)) + Float64(sin(lambda2) * Float64(-1.0 - Float64(-0.5 * (lambda1 ^ 2.0)))))), Float64(t_0 - Float64(t_1 * 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(phi1); tmp = 0.0; if ((lambda1 <= -7e-6) || ~((lambda1 <= 0.32))) 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) * (-1.0 - (-0.5 * (lambda1 ^ 2.0)))))), (t_0 - (t_1 * 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[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -7e-6], N[Not[LessEqual[lambda1, 0.32]], $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[(N[Sin[lambda2], $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[Power[lambda1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * 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 \phi_1\\
\mathbf{if}\;\lambda_1 \leq -7 \cdot 10^{-6} \lor \neg \left(\lambda_1 \leq 0.32\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 \cdot \left(-1 - -0.5 \cdot {\lambda_1}^{2}\right)\right)}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if lambda1 < -6.99999999999999989e-6 or 0.320000000000000007 < lambda1 Initial program 58.5%
sin-diff78.6%
Applied egg-rr78.6%
Taylor expanded in lambda2 around 0 78.8%
if -6.99999999999999989e-6 < lambda1 < 0.320000000000000007Initial program 98.0%
Taylor expanded in lambda1 around 0 98.5%
associate-+r+98.5%
+-commutative98.5%
cos-neg98.5%
associate-*r*98.5%
distribute-rgt1-in98.5%
sin-neg98.5%
Simplified98.5%
Final simplification88.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2)))
(t_2 (* (cos phi2) (sin phi1))))
(if (or (<= lambda2 -2050000.0) (not (<= lambda2 8.4e-11)))
(atan2 t_1 (- t_0 (* (cos lambda2) t_2)))
(atan2 t_1 (- t_0 (* (cos lambda1) t_2))))))
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))) * cos(phi2);
double t_2 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda2 <= -2050000.0) || !(lambda2 <= 8.4e-11)) {
tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2)));
} else {
tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2)));
}
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 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)
t_2 = cos(phi2) * sin(phi1)
if ((lambda2 <= (-2050000.0d0)) .or. (.not. (lambda2 <= 8.4d-11))) then
tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2)))
else
tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2)))
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) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2);
double t_2 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda2 <= -2050000.0) || !(lambda2 <= 8.4e-11)) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(lambda2) * t_2)));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(lambda1) * t_2)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2) t_2 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda2 <= -2050000.0) or not (lambda2 <= 8.4e-11): tmp = math.atan2(t_1, (t_0 - (math.cos(lambda2) * t_2))) else: tmp = math.atan2(t_1, (t_0 - (math.cos(lambda1) * t_2))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)) t_2 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda2 <= -2050000.0) || !(lambda2 <= 8.4e-11)) tmp = atan(t_1, Float64(t_0 - Float64(cos(lambda2) * t_2))); else tmp = atan(t_1, Float64(t_0 - Float64(cos(lambda1) * t_2))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2); t_2 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda2 <= -2050000.0) || ~((lambda2 <= 8.4e-11))) tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2))); else tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2))); 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[(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]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda2, -2050000.0], N[Not[LessEqual[lambda2, 8.4e-11]], $MachinePrecision]], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_2 \leq -2050000 \lor \neg \left(\lambda_2 \leq 8.4 \cdot 10^{-11}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \lambda_2 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \lambda_1 \cdot t\_2}\\
\end{array}
\end{array}
if lambda2 < -2.05e6 or 8.3999999999999994e-11 < lambda2 Initial program 59.7%
sin-diff79.2%
Applied egg-rr79.2%
Taylor expanded in lambda1 around 0 79.5%
cos-neg79.5%
Simplified79.5%
if -2.05e6 < lambda2 < 8.3999999999999994e-11Initial program 97.4%
sin-diff98.3%
Applied egg-rr98.3%
Taylor expanded in lambda2 around 0 98.3%
Final simplification89.0%
(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 78.9%
sin-diff88.9%
Applied egg-rr88.9%
Final simplification88.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos lambda2))) (t_1 (cos (- lambda1 lambda2))))
(if (or (<= phi1 -9e-14) (not (<= phi1 7.2e-16)))
(atan2
(* (cos phi2) (- t_0 (sin lambda2)))
(- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) t_1)))
(atan2
(* (- t_0 (* (cos lambda1) (sin lambda2))) (cos phi2))
(- (sin phi2) (* (sin phi1) t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(lambda2);
double t_1 = cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -9e-14) || !(phi1 <= 7.2e-16)) {
tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * t_1)));
} else {
tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (sin(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) :: tmp
t_0 = sin(lambda1) * cos(lambda2)
t_1 = cos((lambda1 - lambda2))
if ((phi1 <= (-9d-14)) .or. (.not. (phi1 <= 7.2d-16))) then
tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * t_1)))
else
tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (sin(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.sin(lambda1) * Math.cos(lambda2);
double t_1 = Math.cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -9e-14) || !(phi1 <= 7.2e-16)) {
tmp = Math.atan2((Math.cos(phi2) * (t_0 - Math.sin(lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * t_1)));
} else {
tmp = Math.atan2(((t_0 - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - (Math.sin(phi1) * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(lambda2) t_1 = math.cos((lambda1 - lambda2)) tmp = 0 if (phi1 <= -9e-14) or not (phi1 <= 7.2e-16): tmp = math.atan2((math.cos(phi2) * (t_0 - math.sin(lambda2))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * t_1))) else: tmp = math.atan2(((t_0 - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - (math.sin(phi1) * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(lambda2)) t_1 = cos(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi1 <= -9e-14) || !(phi1 <= 7.2e-16)) tmp = atan(Float64(cos(phi2) * Float64(t_0 - sin(lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * t_1))); else tmp = atan(Float64(Float64(t_0 - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(sin(phi1) * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(lambda1) * cos(lambda2); t_1 = cos((lambda1 - lambda2)); tmp = 0.0; if ((phi1 <= -9e-14) || ~((phi1 <= 7.2e-16))) tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * t_1))); else tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (sin(phi1) * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi1, -9e-14], N[Not[LessEqual[phi1, 7.2e-16]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[Sin[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] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -9 \cdot 10^{-14} \lor \neg \left(\phi_1 \leq 7.2 \cdot 10^{-16}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_0 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - \sin \phi_1 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -8.9999999999999995e-14 or 7.19999999999999965e-16 < phi1 Initial program 75.4%
sin-diff79.2%
Applied egg-rr79.2%
Taylor expanded in lambda1 around 0 77.1%
if -8.9999999999999995e-14 < phi1 < 7.19999999999999965e-16Initial program 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.8%
sin-diff99.8%
Applied egg-rr99.8%
Final simplification87.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos lambda2)))
(t_1 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(if (or (<= phi1 -6.5e-7) (not (<= phi1 1e-16)))
(atan2
(* (cos phi2) (- t_0 (sin lambda2)))
(- (* (cos phi1) (sin phi2)) t_1))
(atan2
(* (- t_0 (* (cos lambda1) (sin lambda2))) (cos phi2))
(- (sin phi2) t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(lambda2);
double t_1 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -6.5e-7) || !(phi1 <= 1e-16)) {
tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_1));
} else {
tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - 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 = sin(lambda1) * cos(lambda2)
t_1 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))
if ((phi1 <= (-6.5d-7)) .or. (.not. (phi1 <= 1d-16))) then
tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_1))
else
tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_1))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(lambda1) * Math.cos(lambda2);
double t_1 = (Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -6.5e-7) || !(phi1 <= 1e-16)) {
tmp = Math.atan2((Math.cos(phi2) * (t_0 - Math.sin(lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - t_1));
} else {
tmp = Math.atan2(((t_0 - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - t_1));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(lambda2) t_1 = (math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)) tmp = 0 if (phi1 <= -6.5e-7) or not (phi1 <= 1e-16): tmp = math.atan2((math.cos(phi2) * (t_0 - math.sin(lambda2))), ((math.cos(phi1) * math.sin(phi2)) - t_1)) else: tmp = math.atan2(((t_0 - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - t_1)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(lambda2)) t_1 = Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))) tmp = 0.0 if ((phi1 <= -6.5e-7) || !(phi1 <= 1e-16)) tmp = atan(Float64(cos(phi2) * Float64(t_0 - sin(lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - t_1)); else tmp = atan(Float64(Float64(t_0 - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - t_1)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(lambda1) * cos(lambda2); t_1 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)); tmp = 0.0; if ((phi1 <= -6.5e-7) || ~((phi1 <= 1e-16))) tmp = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_1)); else tmp = atan2(((t_0 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_1)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi1, -6.5e-7], N[Not[LessEqual[phi1, 1e-16]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_1 := \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -6.5 \cdot 10^{-7} \lor \neg \left(\phi_1 \leq 10^{-16}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_0 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - t\_1}\\
\end{array}
\end{array}
if phi1 < -6.50000000000000024e-7 or 9.9999999999999998e-17 < phi1 Initial program 75.1%
sin-diff78.9%
Applied egg-rr78.9%
Taylor expanded in lambda1 around 0 76.7%
if -6.50000000000000024e-7 < phi1 < 9.9999999999999998e-17Initial program 83.1%
sin-diff99.8%
Applied egg-rr99.8%
Taylor expanded in phi1 around 0 99.8%
Final simplification87.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin phi1) t_1))
(t_3 (sin (- lambda1 lambda2))))
(if (<= phi1 -3.2e-13)
(atan2 (* (cos phi2) t_3) (- t_0 (* (cos phi2) t_2)))
(if (<= phi1 5.2e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (sin phi2) t_2))
(atan2
(* (cos phi2) (log1p (expm1 t_3)))
(- t_0 (* (* (cos phi2) (sin 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(phi1) * t_1;
double t_3 = sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = atan2((cos(phi2) * t_3), (t_0 - (cos(phi2) * t_2)));
} else if (phi1 <= 5.2e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_2));
} else {
tmp = atan2((cos(phi2) * log1p(expm1(t_3))), (t_0 - ((cos(phi2) * sin(phi1)) * 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((lambda1 - lambda2));
double t_2 = Math.sin(phi1) * t_1;
double t_3 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = Math.atan2((Math.cos(phi2) * t_3), (t_0 - (Math.cos(phi2) * t_2)));
} else if (phi1 <= 5.2e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - t_2));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.log1p(Math.expm1(t_3))), (t_0 - ((Math.cos(phi2) * Math.sin(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(phi1) * t_1 t_3 = math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -3.2e-13: tmp = math.atan2((math.cos(phi2) * t_3), (t_0 - (math.cos(phi2) * t_2))) elif phi1 <= 5.2e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - t_2)) else: tmp = math.atan2((math.cos(phi2) * math.log1p(math.expm1(t_3))), (t_0 - ((math.cos(phi2) * math.sin(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 = Float64(sin(phi1) * t_1) t_3 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -3.2e-13) tmp = atan(Float64(cos(phi2) * t_3), Float64(t_0 - Float64(cos(phi2) * t_2))); elseif (phi1 <= 5.2e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - t_2)); else tmp = atan(Float64(cos(phi2) * log1p(expm1(t_3))), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * 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[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3.2e-13], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 5.2e-16], 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[Sin[phi2], $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Log[1 + N[(Exp[t$95$3] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $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 \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \phi_1 \cdot t\_1\\
t_3 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -3.2 \cdot 10^{-13}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_3}{t\_0 - \cos \phi_2 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 5.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_3\right)\right)}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -3.2e-13Initial program 80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if -3.2e-13 < phi1 < 5.1999999999999997e-16Initial program 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.8%
sin-diff99.8%
Applied egg-rr99.8%
if 5.1999999999999997e-16 < phi1 Initial program 71.0%
log1p-expm1-u71.1%
Applied egg-rr71.1%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin phi1) t_1))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -3.2e-13)
(atan2 t_3 (- t_0 (* (cos phi2) t_2)))
(if (<= phi1 7.2e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (sin phi2) t_2))
(atan2
t_3
(- t_0 (* (* (cos phi2) (sin phi1)) (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((lambda1 - lambda2));
double t_2 = sin(phi1) * t_1;
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2)));
} else if (phi1 <= 7.2e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_2));
} else {
tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(phi1)) * 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((lambda1 - lambda2));
double t_2 = Math.sin(phi1) * t_1;
double t_3 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = Math.atan2(t_3, (t_0 - (Math.cos(phi2) * t_2)));
} else if (phi1 <= 7.2e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - t_2));
} else {
tmp = Math.atan2(t_3, (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * 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((lambda1 - lambda2)) t_2 = math.sin(phi1) * t_1 t_3 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -3.2e-13: tmp = math.atan2(t_3, (t_0 - (math.cos(phi2) * t_2))) elif phi1 <= 7.2e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - t_2)) else: tmp = math.atan2(t_3, (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.expm1(math.log1p(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 = Float64(sin(phi1) * t_1) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -3.2e-13) tmp = atan(t_3, Float64(t_0 - Float64(cos(phi2) * t_2))); elseif (phi1 <= 7.2e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - t_2)); else tmp = atan(t_3, Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * 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[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3.2e-13], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 7.2e-16], 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[Sin[phi2], $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * 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 \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \phi_1 \cdot t\_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -3.2 \cdot 10^{-13}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \cos \phi_2 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 7.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -3.2e-13Initial program 80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if -3.2e-13 < phi1 < 7.19999999999999965e-16Initial program 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.8%
sin-diff99.8%
Applied egg-rr99.8%
if 7.19999999999999965e-16 < phi1 Initial program 71.0%
expm1-log1p-u71.1%
Applied egg-rr71.1%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_3 (cos (- lambda1 lambda2))))
(if (<= phi1 -6e-16)
(atan2 t_2 (- t_0 (* t_1 (log1p (expm1 t_3)))))
(if (<= phi1 5e-17)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (sin phi2) (* (sin phi1) t_3)))
(atan2 t_2 (- t_0 (* t_1 (expm1 (log1p t_3)))))))))
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(phi2) * sin((lambda1 - lambda2));
double t_3 = cos((lambda1 - lambda2));
double tmp;
if (phi1 <= -6e-16) {
tmp = atan2(t_2, (t_0 - (t_1 * log1p(expm1(t_3)))));
} else if (phi1 <= 5e-17) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (sin(phi1) * t_3)));
} else {
tmp = atan2(t_2, (t_0 - (t_1 * expm1(log1p(t_3)))));
}
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(phi2) * Math.sin((lambda1 - lambda2));
double t_3 = Math.cos((lambda1 - lambda2));
double tmp;
if (phi1 <= -6e-16) {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.log1p(Math.expm1(t_3)))));
} else if (phi1 <= 5e-17) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - (Math.sin(phi1) * t_3)));
} else {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.expm1(Math.log1p(t_3)))));
}
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(phi2) * math.sin((lambda1 - lambda2)) t_3 = math.cos((lambda1 - lambda2)) tmp = 0 if phi1 <= -6e-16: tmp = math.atan2(t_2, (t_0 - (t_1 * math.log1p(math.expm1(t_3))))) elif phi1 <= 5e-17: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - (math.sin(phi1) * t_3))) else: tmp = math.atan2(t_2, (t_0 - (t_1 * math.expm1(math.log1p(t_3))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_3 = cos(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -6e-16) tmp = atan(t_2, Float64(t_0 - Float64(t_1 * log1p(expm1(t_3))))); elseif (phi1 <= 5e-17) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(sin(phi1) * t_3))); else tmp = atan(t_2, Float64(t_0 - Float64(t_1 * expm1(log1p(t_3))))); 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[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -6e-16], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[Log[1 + N[(Exp[t$95$3] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 5e-17], 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[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[(Exp[N[Log[1 + t$95$3], $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 \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_3 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -6 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_3\right)\right)}\\
\mathbf{elif}\;\phi_1 \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - \sin \phi_1 \cdot t\_3}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_3\right)\right)}\\
\end{array}
\end{array}
if phi1 < -5.99999999999999987e-16Initial program 80.1%
log1p-expm1-u80.1%
Applied egg-rr80.1%
if -5.99999999999999987e-16 < phi1 < 4.9999999999999999e-17Initial program 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.8%
sin-diff99.8%
Applied egg-rr99.8%
if 4.9999999999999999e-17 < phi1 Initial program 71.0%
expm1-log1p-u71.1%
Applied egg-rr71.1%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin phi1) t_1))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -3.2e-13)
(atan2 t_3 (- t_0 (* (cos phi2) t_2)))
(if (<= phi1 7.2e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (sin phi2) t_2))
(atan2 t_3 (- t_0 (* (* (cos phi2) (sin 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(phi1) * t_1;
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2)));
} else if (phi1 <= 7.2e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_2));
} else {
tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(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) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
t_2 = sin(phi1) * t_1
t_3 = cos(phi2) * sin((lambda1 - lambda2))
if (phi1 <= (-3.2d-13)) then
tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2)))
else if (phi1 <= 7.2d-16) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_2))
else
tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(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(phi1) * t_1;
double t_3 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -3.2e-13) {
tmp = Math.atan2(t_3, (t_0 - (Math.cos(phi2) * t_2)));
} else if (phi1 <= 7.2e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.sin(phi2) - t_2));
} else {
tmp = Math.atan2(t_3, (t_0 - ((Math.cos(phi2) * Math.sin(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(phi1) * t_1 t_3 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -3.2e-13: tmp = math.atan2(t_3, (t_0 - (math.cos(phi2) * t_2))) elif phi1 <= 7.2e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.sin(phi2) - t_2)) else: tmp = math.atan2(t_3, (t_0 - ((math.cos(phi2) * math.sin(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 = Float64(sin(phi1) * t_1) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -3.2e-13) tmp = atan(t_3, Float64(t_0 - Float64(cos(phi2) * t_2))); elseif (phi1 <= 7.2e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - t_2)); else tmp = atan(t_3, Float64(t_0 - Float64(Float64(cos(phi2) * sin(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(phi1) * t_1; t_3 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (phi1 <= -3.2e-13) tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2))); elseif (phi1 <= 7.2e-16) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - t_2)); else tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(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[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3.2e-13], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 7.2e-16], 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[Sin[phi2], $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $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 \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \phi_1 \cdot t\_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -3.2 \cdot 10^{-13}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \cos \phi_2 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 7.2 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -3.2e-13Initial program 80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
if -3.2e-13 < phi1 < 7.19999999999999965e-16Initial program 82.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.8%
sin-diff99.8%
Applied egg-rr99.8%
if 7.19999999999999965e-16 < phi1 Initial program 71.0%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(atan2
(* (sin lambda2) (- (cos phi2)))
(- t_0 (* (cos lambda2) (* (cos phi2) (sin phi1))))))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_3 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
(if (<= lambda2 -32000000.0)
t_1
(if (<= lambda2 -3.35e-198)
(atan2
t_2
(-
(sin phi2)
(* (sin phi1) (+ (cos lambda1) (* (sin lambda1) lambda2)))))
(if (<= lambda2 1e-145)
(atan2 (* (sin lambda1) (cos phi2)) (- t_0 t_3))
(if (<= lambda2 2.3e+101) (atan2 t_2 (- (sin phi2) t_3)) t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1)))));
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double t_3 = cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2)));
double tmp;
if (lambda2 <= -32000000.0) {
tmp = t_1;
} else if (lambda2 <= -3.35e-198) {
tmp = atan2(t_2, (sin(phi2) - (sin(phi1) * (cos(lambda1) + (sin(lambda1) * lambda2)))));
} else if (lambda2 <= 1e-145) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - t_3));
} else if (lambda2 <= 2.3e+101) {
tmp = atan2(t_2, (sin(phi2) - t_3));
} else {
tmp = 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) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1)))))
t_2 = cos(phi2) * sin((lambda1 - lambda2))
t_3 = cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2)))
if (lambda2 <= (-32000000.0d0)) then
tmp = t_1
else if (lambda2 <= (-3.35d-198)) then
tmp = atan2(t_2, (sin(phi2) - (sin(phi1) * (cos(lambda1) + (sin(lambda1) * lambda2)))))
else if (lambda2 <= 1d-145) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - t_3))
else if (lambda2 <= 2.3d+101) then
tmp = atan2(t_2, (sin(phi2) - t_3))
else
tmp = 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.atan2((Math.sin(lambda2) * -Math.cos(phi2)), (t_0 - (Math.cos(lambda2) * (Math.cos(phi2) * Math.sin(phi1)))));
double t_2 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double t_3 = Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2)));
double tmp;
if (lambda2 <= -32000000.0) {
tmp = t_1;
} else if (lambda2 <= -3.35e-198) {
tmp = Math.atan2(t_2, (Math.sin(phi2) - (Math.sin(phi1) * (Math.cos(lambda1) + (Math.sin(lambda1) * lambda2)))));
} else if (lambda2 <= 1e-145) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - t_3));
} else if (lambda2 <= 2.3e+101) {
tmp = Math.atan2(t_2, (Math.sin(phi2) - t_3));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.atan2((math.sin(lambda2) * -math.cos(phi2)), (t_0 - (math.cos(lambda2) * (math.cos(phi2) * math.sin(phi1))))) t_2 = math.cos(phi2) * math.sin((lambda1 - lambda2)) t_3 = math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2))) tmp = 0 if lambda2 <= -32000000.0: tmp = t_1 elif lambda2 <= -3.35e-198: tmp = math.atan2(t_2, (math.sin(phi2) - (math.sin(phi1) * (math.cos(lambda1) + (math.sin(lambda1) * lambda2))))) elif lambda2 <= 1e-145: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - t_3)) elif lambda2 <= 2.3e+101: tmp = math.atan2(t_2, (math.sin(phi2) - t_3)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), Float64(t_0 - Float64(cos(lambda2) * Float64(cos(phi2) * sin(phi1))))) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_3 = Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (lambda2 <= -32000000.0) tmp = t_1; elseif (lambda2 <= -3.35e-198) tmp = atan(t_2, Float64(sin(phi2) - Float64(sin(phi1) * Float64(cos(lambda1) + Float64(sin(lambda1) * lambda2))))); elseif (lambda2 <= 1e-145) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - t_3)); elseif (lambda2 <= 2.3e+101) tmp = atan(t_2, Float64(sin(phi2) - t_3)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = atan2((sin(lambda2) * -cos(phi2)), (t_0 - (cos(lambda2) * (cos(phi2) * sin(phi1))))); t_2 = cos(phi2) * sin((lambda1 - lambda2)); t_3 = cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))); tmp = 0.0; if (lambda2 <= -32000000.0) tmp = t_1; elseif (lambda2 <= -3.35e-198) tmp = atan2(t_2, (sin(phi2) - (sin(phi1) * (cos(lambda1) + (sin(lambda1) * lambda2))))); elseif (lambda2 <= 1e-145) tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - t_3)); elseif (lambda2 <= 2.3e+101) tmp = atan2(t_2, (sin(phi2) - t_3)); else tmp = 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[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]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -32000000.0], t$95$1, If[LessEqual[lambda2, -3.35e-198], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * lambda2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 1e-145], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 2.3e+101], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \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)}\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_3 := \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\\
\mathbf{if}\;\lambda_2 \leq -32000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_2 \leq -3.35 \cdot 10^{-198}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\sin \phi_2 - \sin \phi_1 \cdot \left(\cos \lambda_1 + \sin \lambda_1 \cdot \lambda_2\right)}\\
\mathbf{elif}\;\lambda_2 \leq 10^{-145}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - t\_3}\\
\mathbf{elif}\;\lambda_2 \leq 2.3 \cdot 10^{+101}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\sin \phi_2 - t\_3}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda2 < -3.2e7 or 2.3000000000000001e101 < lambda2 Initial program 56.8%
sin-diff77.1%
Applied egg-rr77.1%
Taylor expanded in lambda1 around 0 77.4%
cos-neg77.4%
Simplified77.4%
Taylor expanded in lambda1 around 0 61.1%
mul-1-neg61.1%
distribute-rgt-neg-in61.1%
Simplified61.1%
if -3.2e7 < lambda2 < -3.34999999999999991e-198Initial program 92.2%
*-commutative92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in phi1 around 0 84.3%
Taylor expanded in phi2 around 0 84.3%
Taylor expanded in lambda2 around 0 84.3%
if -3.34999999999999991e-198 < lambda2 < 9.99999999999999915e-146Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in lambda2 around 0 93.5%
if 9.99999999999999915e-146 < lambda2 < 2.3000000000000001e101Initial program 85.8%
*-commutative85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in phi1 around 0 81.6%
Final simplification76.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (or (<= phi2 -6.4e-7) (not (<= phi2 2.8e-26)))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- (* (cos phi1) (sin phi2)) (* (cos phi2) t_0)))
(atan2
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(- (sin phi2) t_0)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos((lambda1 - lambda2));
double tmp;
if ((phi2 <= -6.4e-7) || !(phi2 <= 2.8e-26)) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * t_0)));
} else {
tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - 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 = sin(phi1) * cos((lambda1 - lambda2))
if ((phi2 <= (-6.4d-7)) .or. (.not. (phi2 <= 2.8d-26))) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * t_0)))
else
tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - t_0))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(phi1) * Math.cos((lambda1 - lambda2));
double tmp;
if ((phi2 <= -6.4e-7) || !(phi2 <= 2.8e-26)) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(phi2) * t_0)));
} else {
tmp = Math.atan2(((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))), (Math.sin(phi2) - t_0));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(phi1) * math.cos((lambda1 - lambda2)) tmp = 0 if (phi2 <= -6.4e-7) or not (phi2 <= 2.8e-26): tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(phi2) * t_0))) else: tmp = math.atan2(((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))), (math.sin(phi2) - t_0)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))) tmp = 0.0 if ((phi2 <= -6.4e-7) || !(phi2 <= 2.8e-26)) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * t_0))); else tmp = atan(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))), Float64(sin(phi2) - t_0)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(phi1) * cos((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -6.4e-7) || ~((phi2 <= 2.8e-26))) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * t_0))); else tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - t_0)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi2, -6.4e-7], N[Not[LessEqual[phi2, 2.8e-26]], $MachinePrecision]], 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[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -6.4 \cdot 10^{-7} \lor \neg \left(\phi_2 \leq 2.8 \cdot 10^{-26}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2}{\sin \phi_2 - t\_0}\\
\end{array}
\end{array}
if phi2 < -6.4000000000000001e-7 or 2.8000000000000001e-26 < phi2 Initial program 75.0%
*-commutative75.0%
associate-*l*75.0%
Simplified75.0%
if -6.4000000000000001e-7 < phi2 < 2.8000000000000001e-26Initial program 82.9%
*-commutative82.9%
associate-*l*82.9%
Simplified82.9%
Taylor expanded in phi1 around 0 82.9%
Taylor expanded in phi2 around 0 82.9%
Taylor expanded in phi2 around 0 82.9%
sin-diff89.5%
Applied egg-rr89.5%
Final simplification82.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin phi1) t_1))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi2 -6e-6)
(atan2 t_3 (- t_0 (* (* (cos phi2) (sin phi1)) t_1)))
(if (<= phi2 2.8e-26)
(atan2
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(- (sin phi2) t_2))
(atan2 t_3 (- t_0 (* (cos phi2) t_2)))))))
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(phi1) * t_1;
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi2 <= -6e-6) {
tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(phi1)) * t_1)));
} else if (phi2 <= 2.8e-26) {
tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - t_2));
} else {
tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2)));
}
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) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
t_2 = sin(phi1) * t_1
t_3 = cos(phi2) * sin((lambda1 - lambda2))
if (phi2 <= (-6d-6)) then
tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(phi1)) * t_1)))
else if (phi2 <= 2.8d-26) then
tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - t_2))
else
tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2)))
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(phi1) * t_1;
double t_3 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= -6e-6) {
tmp = Math.atan2(t_3, (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * t_1)));
} else if (phi2 <= 2.8e-26) {
tmp = Math.atan2(((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))), (Math.sin(phi2) - t_2));
} else {
tmp = Math.atan2(t_3, (t_0 - (Math.cos(phi2) * t_2)));
}
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(phi1) * t_1 t_3 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= -6e-6: tmp = math.atan2(t_3, (t_0 - ((math.cos(phi2) * math.sin(phi1)) * t_1))) elif phi2 <= 2.8e-26: tmp = math.atan2(((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))), (math.sin(phi2) - t_2)) else: tmp = math.atan2(t_3, (t_0 - (math.cos(phi2) * t_2))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(sin(phi1) * t_1) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi2 <= -6e-6) tmp = atan(t_3, Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * t_1))); elseif (phi2 <= 2.8e-26) tmp = atan(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))), Float64(sin(phi2) - t_2)); else tmp = atan(t_3, Float64(t_0 - Float64(cos(phi2) * t_2))); 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(phi1) * t_1; t_3 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= -6e-6) tmp = atan2(t_3, (t_0 - ((cos(phi2) * sin(phi1)) * t_1))); elseif (phi2 <= 2.8e-26) tmp = atan2(((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))), (sin(phi2) - t_2)); else tmp = atan2(t_3, (t_0 - (cos(phi2) * t_2))); 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[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -6e-6], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2.8e-26], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$3 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $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 \phi_1 \cdot t\_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -6 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_1}\\
\mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-26}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2}{\sin \phi_2 - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - \cos \phi_2 \cdot t\_2}\\
\end{array}
\end{array}
if phi2 < -6.0000000000000002e-6Initial program 73.4%
if -6.0000000000000002e-6 < phi2 < 2.8000000000000001e-26Initial program 82.9%
*-commutative82.9%
associate-*l*82.9%
Simplified82.9%
Taylor expanded in phi1 around 0 82.9%
Taylor expanded in phi2 around 0 82.9%
Taylor expanded in phi2 around 0 82.9%
sin-diff89.5%
Applied egg-rr89.5%
if 2.8000000000000001e-26 < phi2 Initial program 76.4%
*-commutative76.4%
associate-*l*76.5%
Simplified76.5%
Final simplification82.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda2 -2050000.0) (not (<= lambda2 1.8e+30)))
(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 <= -2050000.0) || !(lambda2 <= 1.8e+30)) {
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 <= (-2050000.0d0)) .or. (.not. (lambda2 <= 1.8d+30))) 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 <= -2050000.0) || !(lambda2 <= 1.8e+30)) {
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 <= -2050000.0) or not (lambda2 <= 1.8e+30): 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 <= -2050000.0) || !(lambda2 <= 1.8e+30)) 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 <= -2050000.0) || ~((lambda2 <= 1.8e+30))) 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, -2050000.0], N[Not[LessEqual[lambda2, 1.8e+30]], $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 -2050000 \lor \neg \left(\lambda_2 \leq 1.8 \cdot 10^{+30}\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 < -2.05e6 or 1.8000000000000001e30 < lambda2 Initial program 57.3%
sin-diff77.7%
Applied egg-rr77.7%
Taylor expanded in lambda1 around 0 78.1%
cos-neg78.1%
Simplified78.1%
Taylor expanded in lambda1 around 0 60.1%
mul-1-neg60.1%
distribute-rgt-neg-in60.1%
Simplified60.1%
if -2.05e6 < lambda2 < 1.8000000000000001e30Initial program 96.2%
Taylor expanded in lambda2 around 0 95.7%
Final simplification79.9%
(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)))
(t_3 (- t_2 (* (cos lambda2) t_0))))
(if (<= lambda2 -2200000.0)
(atan2 (* (sin lambda2) (- (cos phi2))) t_3)
(if (<= lambda2 8.4e-11)
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))
(atan2 t_1 t_3)))))
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 t_3 = t_2 - (cos(lambda2) * t_0);
double tmp;
if (lambda2 <= -2200000.0) {
tmp = atan2((sin(lambda2) * -cos(phi2)), t_3);
} else if (lambda2 <= 8.4e-11) {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
} else {
tmp = atan2(t_1, t_3);
}
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) :: t_3
real(8) :: tmp
t_0 = cos(phi2) * sin(phi1)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
t_2 = cos(phi1) * sin(phi2)
t_3 = t_2 - (cos(lambda2) * t_0)
if (lambda2 <= (-2200000.0d0)) then
tmp = atan2((sin(lambda2) * -cos(phi2)), t_3)
else if (lambda2 <= 8.4d-11) then
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
else
tmp = atan2(t_1, t_3)
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 t_3 = t_2 - (Math.cos(lambda2) * t_0);
double tmp;
if (lambda2 <= -2200000.0) {
tmp = Math.atan2((Math.sin(lambda2) * -Math.cos(phi2)), t_3);
} else if (lambda2 <= 8.4e-11) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
} else {
tmp = Math.atan2(t_1, t_3);
}
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) t_3 = t_2 - (math.cos(lambda2) * t_0) tmp = 0 if lambda2 <= -2200000.0: tmp = math.atan2((math.sin(lambda2) * -math.cos(phi2)), t_3) elif lambda2 <= 8.4e-11: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) else: tmp = math.atan2(t_1, t_3) 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)) t_3 = Float64(t_2 - Float64(cos(lambda2) * t_0)) tmp = 0.0 if (lambda2 <= -2200000.0) tmp = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), t_3); elseif (lambda2 <= 8.4e-11) tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); else tmp = atan(t_1, t_3); 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); t_3 = t_2 - (cos(lambda2) * t_0); tmp = 0.0; if (lambda2 <= -2200000.0) tmp = atan2((sin(lambda2) * -cos(phi2)), t_3); elseif (lambda2 <= 8.4e-11) tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); else tmp = atan2(t_1, t_3); 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]}, Block[{t$95$3 = N[(t$95$2 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -2200000.0], N[ArcTan[N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] / t$95$3], $MachinePrecision], If[LessEqual[lambda2, 8.4e-11], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / t$95$3], $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\\
t_3 := t\_2 - \cos \lambda_2 \cdot t\_0\\
\mathbf{if}\;\lambda_2 \leq -2200000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_2 \cdot \left(-\cos \phi_2\right)}{t\_3}\\
\mathbf{elif}\;\lambda_2 \leq 8.4 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_3}\\
\end{array}
\end{array}
if lambda2 < -2.2e6Initial program 58.5%
sin-diff79.2%
Applied egg-rr79.2%
Taylor expanded in lambda1 around 0 79.1%
cos-neg79.1%
Simplified79.1%
Taylor expanded in lambda1 around 0 64.4%
mul-1-neg64.4%
distribute-rgt-neg-in64.4%
Simplified64.4%
if -2.2e6 < lambda2 < 8.3999999999999994e-11Initial program 97.4%
Taylor expanded in lambda2 around 0 97.4%
if 8.3999999999999994e-11 < lambda2 Initial program 60.7%
Taylor expanded in lambda1 around 0 61.0%
cos-neg79.8%
Simplified61.0%
Final simplification80.3%
(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 (<= lambda2 -2050000.0)
(atan2
(* (cos phi2) (sin (- lambda2)))
(- t_2 (* t_0 (cos (- lambda1 lambda2)))))
(if (<= lambda2 8.4e-11)
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))
(atan2 t_1 (- t_2 (* (cos lambda2) 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 (lambda2 <= -2050000.0) {
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))));
} else if (lambda2 <= 8.4e-11) {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
} else {
tmp = atan2(t_1, (t_2 - (cos(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) :: 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 (lambda2 <= (-2050000.0d0)) then
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))))
else if (lambda2 <= 8.4d-11) then
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
else
tmp = atan2(t_1, (t_2 - (cos(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(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 (lambda2 <= -2050000.0) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(-lambda2)), (t_2 - (t_0 * Math.cos((lambda1 - lambda2)))));
} else if (lambda2 <= 8.4e-11) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
} else {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda2) * 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 lambda2 <= -2050000.0: tmp = math.atan2((math.cos(phi2) * math.sin(-lambda2)), (t_2 - (t_0 * math.cos((lambda1 - lambda2))))) elif lambda2 <= 8.4e-11: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) else: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda2) * 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 (lambda2 <= -2050000.0) tmp = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(t_2 - Float64(t_0 * cos(Float64(lambda1 - lambda2))))); elseif (lambda2 <= 8.4e-11) tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); else tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda2) * 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 (lambda2 <= -2050000.0) tmp = atan2((cos(phi2) * sin(-lambda2)), (t_2 - (t_0 * cos((lambda1 - lambda2))))); elseif (lambda2 <= 8.4e-11) tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); else tmp = atan2(t_1, (t_2 - (cos(lambda2) * 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[lambda2, -2050000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(t$95$0 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 8.4e-11], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda2], $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_2 \leq -2050000:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{t\_2 - t\_0 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_2 \leq 8.4 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_2 \cdot t\_0}\\
\end{array}
\end{array}
if lambda2 < -2.05e6Initial program 58.5%
Taylor expanded in lambda1 around 0 64.5%
if -2.05e6 < lambda2 < 8.3999999999999994e-11Initial program 97.4%
Taylor expanded in lambda2 around 0 97.4%
if 8.3999999999999994e-11 < lambda2 Initial program 60.7%
Taylor expanded in lambda1 around 0 61.0%
cos-neg79.8%
Simplified61.0%
Final simplification80.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (or (<= lambda2 -3.6e+20) (not (<= lambda2 1.1e+97)))
(atan2
(* (sin lambda2) (- (cos phi2)))
(- (* (cos phi1) (sin phi2)) (* (cos lambda2) (* (cos phi2) (sin phi1)))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- (sin phi2) (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda2 <= -3.6e+20) || !(lambda2 <= 1.1e+97)) {
tmp = atan2((sin(lambda2) * -cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * (cos(phi2) * sin(phi1)))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(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 ((lambda2 <= (-3.6d+20)) .or. (.not. (lambda2 <= 1.1d+97))) then
tmp = atan2((sin(lambda2) * -cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * (cos(phi2) * sin(phi1)))))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(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 ((lambda2 <= -3.6e+20) || !(lambda2 <= 1.1e+97)) {
tmp = Math.atan2((Math.sin(lambda2) * -Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(lambda2) * (Math.cos(phi2) * Math.sin(phi1)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(phi2) - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if (lambda2 <= -3.6e+20) or not (lambda2 <= 1.1e+97): tmp = math.atan2((math.sin(lambda2) * -math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(lambda2) * (math.cos(phi2) * math.sin(phi1))))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.sin(phi2) - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if ((lambda2 <= -3.6e+20) || !(lambda2 <= 1.1e+97)) tmp = atan(Float64(sin(lambda2) * Float64(-cos(phi2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(lambda2) * Float64(cos(phi2) * sin(phi1))))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if ((lambda2 <= -3.6e+20) || ~((lambda2 <= 1.1e+97))) tmp = atan2((sin(lambda2) * -cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * (cos(phi2) * sin(phi1))))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[Or[LessEqual[lambda2, -3.6e+20], N[Not[LessEqual[lambda2, 1.1e+97]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - 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[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_2 \leq -3.6 \cdot 10^{+20} \lor \neg \left(\lambda_2 \leq 1.1 \cdot 10^{+97}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_2 \cdot \left(-\cos \phi_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \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)}{\sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\end{array}
\end{array}
if lambda2 < -3.6e20 or 1.1e97 < lambda2 Initial program 56.3%
sin-diff77.2%
Applied egg-rr77.2%
Taylor expanded in lambda1 around 0 77.5%
cos-neg77.5%
Simplified77.5%
Taylor expanded in lambda1 around 0 60.7%
mul-1-neg60.7%
distribute-rgt-neg-in60.7%
Simplified60.7%
if -3.6e20 < lambda2 < 1.1e97Initial program 92.7%
*-commutative92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in phi1 around 0 79.4%
Final simplification72.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (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))), (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))), (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.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.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(sin(phi2) - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (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[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}
\end{array}
Initial program 78.9%
*-commutative78.9%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in phi1 around 0 66.4%
Final simplification66.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -0.078) (not (<= phi2 1.6e-33)))
(atan2 (* (cos phi2) t_0) (- (sin phi2) (* (cos lambda1) (sin phi1))))
(atan2 t_0 (- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.078) || !(phi2 <= 1.6e-33)) {
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(lambda1) * sin(phi1))));
} else {
tmp = atan2(t_0, (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) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if ((phi2 <= (-0.078d0)) .or. (.not. (phi2 <= 1.6d-33))) then
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(lambda1) * sin(phi1))))
else
tmp = atan2(t_0, (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 t_0 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.078) || !(phi2 <= 1.6e-33)) {
tmp = Math.atan2((Math.cos(phi2) * t_0), (Math.sin(phi2) - (Math.cos(lambda1) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -0.078) or not (phi2 <= 1.6e-33): tmp = math.atan2((math.cos(phi2) * t_0), (math.sin(phi2) - (math.cos(lambda1) * math.sin(phi1)))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -0.078) || !(phi2 <= 1.6e-33)) tmp = atan(Float64(cos(phi2) * t_0), Float64(sin(phi2) - Float64(cos(lambda1) * sin(phi1)))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -0.078) || ~((phi2 <= 1.6e-33))) tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(lambda1) * sin(phi1)))); else tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -0.078], N[Not[LessEqual[phi2, 1.6e-33]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / 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}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.078 \lor \neg \left(\phi_2 \leq 1.6 \cdot 10^{-33}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2 - \cos \lambda_1 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -0.0779999999999999999 or 1.59999999999999988e-33 < phi2 Initial program 74.9%
*-commutative74.9%
associate-*l*74.8%
Simplified74.8%
Taylor expanded in phi1 around 0 50.6%
Taylor expanded in phi2 around 0 48.7%
Taylor expanded in lambda2 around 0 48.6%
if -0.0779999999999999999 < phi2 < 1.59999999999999988e-33Initial program 83.0%
*-commutative83.0%
associate-*l*83.0%
Simplified83.0%
Taylor expanded in phi1 around 0 82.5%
Taylor expanded in phi2 around 0 82.5%
Taylor expanded in phi2 around 0 82.5%
Final simplification65.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (or (<= lambda1 -15500000.0) (not (<= lambda1 6.3e+16)))
(atan2
(* (sin lambda1) (cos phi2))
(- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- (sin phi2) (* (cos lambda2) (sin phi1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda1 <= -15500000.0) || !(lambda1 <= 6.3e+16)) {
tmp = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(lambda2) * 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) :: tmp
if ((lambda1 <= (-15500000.0d0)) .or. (.not. (lambda1 <= 6.3d+16))) then
tmp = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(lambda2) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda1 <= -15500000.0) || !(lambda1 <= 6.3e+16)) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(phi2) - (Math.cos(lambda2) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if (lambda1 <= -15500000.0) or not (lambda1 <= 6.3e+16): tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.sin(phi2) - (math.cos(lambda2) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if ((lambda1 <= -15500000.0) || !(lambda1 <= 6.3e+16)) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(cos(lambda2) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if ((lambda1 <= -15500000.0) || ~((lambda1 <= 6.3e+16))) tmp = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - (cos(lambda2) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[Or[LessEqual[lambda1, -15500000.0], N[Not[LessEqual[lambda1, 6.3e+16]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -15500000 \lor \neg \left(\lambda_1 \leq 6.3 \cdot 10^{+16}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \cos \lambda_2 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda1 < -1.55e7 or 6.3e16 < lambda1 Initial program 57.1%
*-commutative57.1%
associate-*l*57.1%
Simplified57.1%
Taylor expanded in phi1 around 0 48.9%
Taylor expanded in phi2 around 0 48.6%
Taylor expanded in lambda2 around 0 50.2%
if -1.55e7 < lambda1 < 6.3e16Initial program 98.1%
*-commutative98.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in phi1 around 0 81.9%
Taylor expanded in phi2 around 0 80.4%
Taylor expanded in lambda1 around 0 80.4%
cos-neg80.4%
Simplified80.4%
Final simplification66.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= lambda2 -110000000.0)
(atan2
(* (cos phi2) (sin (- lambda2)))
(- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (<= lambda2 8.4e-11)
(atan2 t_0 (- (sin phi2) (* (cos lambda1) (sin phi1))))
(atan2 t_0 (- (sin phi2) (* (cos lambda2) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -110000000.0) {
tmp = atan2((cos(phi2) * sin(-lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else if (lambda2 <= 8.4e-11) {
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))));
} else {
tmp = atan2(t_0, (sin(phi2) - (cos(lambda2) * 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(phi2) * sin((lambda1 - lambda2))
if (lambda2 <= (-110000000.0d0)) then
tmp = atan2((cos(phi2) * sin(-lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))))
else if (lambda2 <= 8.4d-11) then
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))))
else
tmp = atan2(t_0, (sin(phi2) - (cos(lambda2) * 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(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -110000000.0) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(-lambda2)), (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else if (lambda2 <= 8.4e-11) {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos(lambda1) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos(lambda2) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if lambda2 <= -110000000.0: tmp = math.atan2((math.cos(phi2) * math.sin(-lambda2)), (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) elif lambda2 <= 8.4e-11: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos(lambda1) * math.sin(phi1)))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos(lambda2) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (lambda2 <= -110000000.0) tmp = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); elseif (lambda2 <= 8.4e-11) tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(lambda1) * sin(phi1)))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(lambda2) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (lambda2 <= -110000000.0) tmp = atan2((cos(phi2) * sin(-lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); elseif (lambda2 <= 8.4e-11) tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1)))); else tmp = atan2(t_0, (sin(phi2) - (cos(lambda2) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -110000000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 8.4e-11], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\lambda_2 \leq -110000000:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_2 \leq 8.4 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \lambda_1 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \lambda_2 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda2 < -1.1e8Initial program 58.5%
*-commutative58.5%
associate-*l*58.5%
Simplified58.5%
Taylor expanded in phi1 around 0 47.9%
Taylor expanded in phi2 around 0 47.1%
Taylor expanded in lambda1 around 0 53.1%
if -1.1e8 < lambda2 < 8.3999999999999994e-11Initial program 97.4%
*-commutative97.4%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in phi1 around 0 81.7%
Taylor expanded in phi2 around 0 80.2%
Taylor expanded in lambda2 around 0 80.2%
if 8.3999999999999994e-11 < lambda2 Initial program 60.7%
*-commutative60.7%
associate-*l*60.7%
Simplified60.7%
Taylor expanded in phi1 around 0 53.0%
Taylor expanded in phi2 around 0 52.8%
Taylor expanded in lambda1 around 0 53.1%
cos-neg53.1%
Simplified53.1%
Final simplification66.9%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * 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((cos(phi2) * 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.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(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.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(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[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $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)}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 78.9%
*-commutative78.9%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in phi1 around 0 66.4%
Taylor expanded in phi2 around 0 65.5%
Final simplification65.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -0.098) (not (<= phi2 0.00014)))
(atan2
(* (cos phi2) t_0)
(- (sin phi2) (* phi1 (cos (- lambda2 lambda1)))))
(atan2 t_0 (- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.098) || !(phi2 <= 0.00014)) {
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (phi1 * cos((lambda2 - lambda1)))));
} else {
tmp = atan2(t_0, (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) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if ((phi2 <= (-0.098d0)) .or. (.not. (phi2 <= 0.00014d0))) then
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (phi1 * cos((lambda2 - lambda1)))))
else
tmp = atan2(t_0, (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 t_0 = Math.sin((lambda1 - lambda2));
double tmp;
if ((phi2 <= -0.098) || !(phi2 <= 0.00014)) {
tmp = Math.atan2((Math.cos(phi2) * t_0), (Math.sin(phi2) - (phi1 * Math.cos((lambda2 - lambda1)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi2 <= -0.098) or not (phi2 <= 0.00014): tmp = math.atan2((math.cos(phi2) * t_0), (math.sin(phi2) - (phi1 * math.cos((lambda2 - lambda1))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi2 <= -0.098) || !(phi2 <= 0.00014)) tmp = atan(Float64(cos(phi2) * t_0), Float64(sin(phi2) - Float64(phi1 * cos(Float64(lambda2 - lambda1))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi2 <= -0.098) || ~((phi2 <= 0.00014))) tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (phi1 * cos((lambda2 - lambda1))))); else tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -0.098], N[Not[LessEqual[phi2, 0.00014]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(phi1 * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / 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}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.098 \lor \neg \left(\phi_2 \leq 0.00014\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2 - \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -0.098000000000000004 or 1.3999999999999999e-4 < phi2 Initial program 74.8%
*-commutative74.8%
associate-*l*74.8%
Simplified74.8%
Taylor expanded in phi1 around 0 49.8%
Taylor expanded in phi2 around 0 47.8%
Taylor expanded in phi1 around 0 44.6%
sub-neg14.7%
remove-double-neg14.7%
mul-1-neg14.7%
distribute-neg-in14.7%
+-commutative14.7%
cos-neg14.7%
mul-1-neg14.7%
sub-neg14.7%
Simplified44.6%
if -0.098000000000000004 < phi2 < 1.3999999999999999e-4Initial program 82.7%
*-commutative82.7%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in phi1 around 0 82.3%
Taylor expanded in phi2 around 0 82.3%
Taylor expanded in phi2 around 0 82.3%
Final simplification63.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (<= phi2 14600000000.0)
(atan2 (sin (- lambda1 lambda2)) (- phi2 t_0))
(atan2 (sin lambda1) (- (sin phi2) t_0)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos((lambda1 - lambda2));
double tmp;
if (phi2 <= 14600000000.0) {
tmp = atan2(sin((lambda1 - lambda2)), (phi2 - t_0));
} else {
tmp = atan2(sin(lambda1), (sin(phi2) - 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 = sin(phi1) * cos((lambda1 - lambda2))
if (phi2 <= 14600000000.0d0) then
tmp = atan2(sin((lambda1 - lambda2)), (phi2 - t_0))
else
tmp = atan2(sin(lambda1), (sin(phi2) - t_0))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(phi1) * Math.cos((lambda1 - lambda2));
double tmp;
if (phi2 <= 14600000000.0) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (phi2 - t_0));
} else {
tmp = Math.atan2(Math.sin(lambda1), (Math.sin(phi2) - t_0));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(phi1) * math.cos((lambda1 - lambda2)) tmp = 0 if phi2 <= 14600000000.0: tmp = math.atan2(math.sin((lambda1 - lambda2)), (phi2 - t_0)) else: tmp = math.atan2(math.sin(lambda1), (math.sin(phi2) - t_0)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi2 <= 14600000000.0) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(phi2 - t_0)); else tmp = atan(sin(lambda1), Float64(sin(phi2) - t_0)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(phi1) * cos((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 14600000000.0) tmp = atan2(sin((lambda1 - lambda2)), (phi2 - t_0)); else tmp = atan2(sin(lambda1), (sin(phi2) - t_0)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, 14600000000.0], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 - t$95$0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 14600000000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\sin \phi_2 - t\_0}\\
\end{array}
\end{array}
if phi2 < 1.46e10Initial program 80.4%
*-commutative80.4%
associate-*l*80.4%
Simplified80.4%
Taylor expanded in phi1 around 0 73.0%
Taylor expanded in phi2 around 0 72.7%
Taylor expanded in phi2 around 0 62.1%
Taylor expanded in phi2 around 0 61.9%
mul-1-neg61.9%
distribute-rgt-neg-out61.9%
Simplified61.9%
if 1.46e10 < phi2 Initial program 74.2%
*-commutative74.2%
associate-*l*74.2%
Simplified74.2%
Taylor expanded in phi1 around 0 46.4%
Taylor expanded in phi2 around 0 43.4%
Taylor expanded in phi2 around 0 10.8%
Taylor expanded in lambda2 around 0 12.5%
Final simplification49.8%
(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 78.9%
*-commutative78.9%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in phi1 around 0 66.4%
Taylor expanded in phi2 around 0 65.5%
Taylor expanded in phi2 around 0 49.5%
Final simplification49.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (or (<= phi1 -2700.0) (not (<= phi1 1.6e-5)))
(atan2 t_0 (* (sin phi1) (- (cos (- lambda1 lambda2)))))
(atan2 t_0 (- (sin phi2) (* phi1 (cos (- lambda2 lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if ((phi1 <= -2700.0) || !(phi1 <= 1.6e-5)) {
tmp = atan2(t_0, (sin(phi1) * -cos((lambda1 - lambda2))));
} else {
tmp = atan2(t_0, (sin(phi2) - (phi1 * cos((lambda2 - lambda1)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if ((phi1 <= (-2700.0d0)) .or. (.not. (phi1 <= 1.6d-5))) then
tmp = atan2(t_0, (sin(phi1) * -cos((lambda1 - lambda2))))
else
tmp = atan2(t_0, (sin(phi2) - (phi1 * cos((lambda2 - lambda1)))))
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 ((phi1 <= -2700.0) || !(phi1 <= 1.6e-5)) {
tmp = Math.atan2(t_0, (Math.sin(phi1) * -Math.cos((lambda1 - lambda2))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (phi1 * Math.cos((lambda2 - lambda1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if (phi1 <= -2700.0) or not (phi1 <= 1.6e-5): tmp = math.atan2(t_0, (math.sin(phi1) * -math.cos((lambda1 - lambda2)))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (phi1 * math.cos((lambda2 - lambda1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi1 <= -2700.0) || !(phi1 <= 1.6e-5)) tmp = atan(t_0, Float64(sin(phi1) * Float64(-cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(phi1 * cos(Float64(lambda2 - lambda1))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if ((phi1 <= -2700.0) || ~((phi1 <= 1.6e-5))) tmp = atan2(t_0, (sin(phi1) * -cos((lambda1 - lambda2)))); else tmp = atan2(t_0, (sin(phi2) - (phi1 * cos((lambda2 - lambda1))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi1, -2700.0], N[Not[LessEqual[phi1, 1.6e-5]], $MachinePrecision]], N[ArcTan[t$95$0 / N[(N[Sin[phi1], $MachinePrecision] * (-N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(phi1 * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -2700 \lor \neg \left(\phi_1 \leq 1.6 \cdot 10^{-5}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_1 \cdot \left(-\cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\end{array}
\end{array}
if phi1 < -2700 or 1.59999999999999993e-5 < phi1 Initial program 73.9%
*-commutative73.9%
associate-*l*73.9%
Simplified73.9%
Taylor expanded in phi1 around 0 50.0%
Taylor expanded in phi2 around 0 48.6%
Taylor expanded in phi2 around 0 45.0%
Taylor expanded in phi2 around 0 45.6%
mul-1-neg45.6%
distribute-rgt-neg-out45.6%
Simplified45.6%
if -2700 < phi1 < 1.59999999999999993e-5Initial program 83.8%
*-commutative83.8%
associate-*l*83.8%
Simplified83.8%
Taylor expanded in phi1 around 0 82.8%
Taylor expanded in phi2 around 0 82.4%
Taylor expanded in phi2 around 0 54.0%
Taylor expanded in phi1 around 0 54.0%
sub-neg54.0%
remove-double-neg54.0%
mul-1-neg54.0%
distribute-neg-in54.0%
+-commutative54.0%
cos-neg54.0%
mul-1-neg54.0%
sub-neg54.0%
Simplified54.0%
Final simplification49.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 1.3)
(atan2 t_0 (- phi2 (* (sin phi1) (cos (- lambda1 lambda2)))))
(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 <= 1.3) {
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))));
} 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 <= 1.3d0) then
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))))
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 <= 1.3) {
tmp = Math.atan2(t_0, (phi2 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} 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 <= 1.3: tmp = math.atan2(t_0, (phi2 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) 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 <= 1.3) tmp = atan(t_0, Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); 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 <= 1.3) tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2))))); 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, 1.3], N[ArcTan[t$95$0 / N[(phi2 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $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 1.3:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.30000000000000004Initial program 80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
Taylor expanded in phi1 around 0 73.4%
Taylor expanded in phi2 around 0 73.2%
Taylor expanded in phi2 around 0 63.0%
Taylor expanded in phi2 around 0 62.8%
mul-1-neg62.8%
distribute-rgt-neg-out62.8%
Simplified62.8%
if 1.30000000000000004 < phi2 Initial program 75.4%
*-commutative75.4%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in phi1 around 0 46.4%
Taylor expanded in phi2 around 0 43.2%
Taylor expanded in phi2 around 0 10.7%
Taylor expanded in phi1 around 0 10.3%
Final simplification49.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (* (sin phi1) (- (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (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(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(phi1) * -Math.cos((lambda1 - lambda2))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (math.sin(phi1) * -math.cos((lambda1 - lambda2))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(sin(phi1) * Float64(-cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (sin(phi1) * -cos((lambda1 - lambda2)))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[phi1], $MachinePrecision] * (-N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_1 \cdot \left(-\cos \left(\lambda_1 - \lambda_2\right)\right)}
\end{array}
Initial program 78.9%
*-commutative78.9%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in phi1 around 0 66.4%
Taylor expanded in phi2 around 0 65.5%
Taylor expanded in phi2 around 0 49.5%
Taylor expanded in phi2 around 0 46.4%
mul-1-neg46.4%
distribute-rgt-neg-out46.4%
Simplified46.4%
Final simplification46.4%
(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 78.9%
*-commutative78.9%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in phi1 around 0 66.4%
Taylor expanded in phi2 around 0 65.5%
Taylor expanded in phi2 around 0 49.5%
Taylor expanded in phi1 around 0 32.2%
Final simplification32.2%
herbie shell --seed 2024031
(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))))))