
(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 27 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
(let* ((t_0 (* (cos lambda2) (cos lambda1)))
(t_1 (* (sin lambda1) (sin lambda2))))
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(/
(+ (pow t_0 3.0) (pow t_1 3.0))
(fma t_0 t_0 (* t_1 (- t_1 t_0)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda2) * cos(lambda1);
double t_1 = sin(lambda1) * sin(lambda2);
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * ((pow(t_0, 3.0) + pow(t_1, 3.0)) / fma(t_0, t_0, (t_1 * (t_1 - t_0)))))));
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda2) * cos(lambda1)) t_1 = Float64(sin(lambda1) * sin(lambda2)) 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((t_0 ^ 3.0) + (t_1 ^ 3.0)) / fma(t_0, t_0, Float64(t_1 * Float64(t_1 - t_0))))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $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[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[t$95$0, 3.0], $MachinePrecision] + N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0 + N[(t$95$1 * N[(t$95$1 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \cos \lambda_1\\
t_1 := \sin \lambda_1 \cdot \sin \lambda_2\\
\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 \frac{{t\_0}^{3} + {t\_1}^{3}}{\mathsf{fma}\left(t\_0, t\_0, t\_1 \cdot \left(t\_1 - t\_0\right)\right)}}
\end{array}
\end{array}
Initial program 81.5%
sin-diff90.8%
Applied egg-rr90.8%
cos-diff99.7%
flip3-+99.7%
*-commutative99.7%
*-commutative99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
fma-def99.7%
distribute-rgt-out--99.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))
(+
(* (cos lambda2) (cos lambda1))
(pow (cbrt (* (sin lambda1) (sin lambda2))) 3.0))))))
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(lambda2) * cos(lambda1)) + pow(cbrt((sin(lambda1) * sin(lambda2))), 3.0)))));
}
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(lambda2) * Math.cos(lambda1)) + Math.pow(Math.cbrt((Math.sin(lambda1) * Math.sin(lambda2))), 3.0)))));
}
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(cos(lambda2) * cos(lambda1)) + (cbrt(Float64(sin(lambda1) * sin(lambda2))) ^ 3.0))))) 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[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $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(\cos \lambda_2 \cdot \cos \lambda_1 + {\left(\sqrt[3]{\sin \lambda_1 \cdot \sin \lambda_2}\right)}^{3}\right)}
\end{array}
Initial program 81.5%
sin-diff90.8%
Applied egg-rr90.8%
cos-diff81.8%
+-commutative81.8%
*-commutative81.8%
Applied egg-rr99.7%
add-cube-cbrt99.7%
pow399.7%
Applied egg-rr99.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))
(+ (* (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)) * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(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(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(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(lambda2) * Math.cos(lambda1)) + (Math.sin(lambda1) * Math.sin(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(lambda2) * math.cos(lambda1)) + (math.sin(lambda1) * math.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)) * Float64(Float64(cos(lambda2) * cos(lambda1)) + Float64(sin(lambda1) * sin(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(lambda2) * cos(lambda1)) + (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[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $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 \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}
\end{array}
Initial program 81.5%
sin-diff90.8%
Applied egg-rr90.8%
cos-diff81.8%
+-commutative81.8%
*-commutative81.8%
Applied egg-rr99.7%
Final simplification99.7%
(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))))
(if (or (<= phi2 -1.8e-5) (not (<= phi2 7.4e-93)))
(atan2
t_1
(- t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
t_1
(-
t_0
(*
(sin phi1)
(+
(* (cos lambda2) (cos lambda1))
(* (sin lambda1) (sin lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2);
double tmp;
if ((phi2 <= -1.8e-5) || !(phi2 <= 7.4e-93)) {
tmp = atan2(t_1, (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_1, (t_0 - (sin(phi1) * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)
if ((phi2 <= (-1.8d-5)) .or. (.not. (phi2 <= 7.4d-93))) then
tmp = atan2(t_1, (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_1, (t_0 - (sin(phi1) * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2);
double tmp;
if ((phi2 <= -1.8e-5) || !(phi2 <= 7.4e-93)) {
tmp = Math.atan2(t_1, (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.sin(phi1) * ((Math.cos(lambda2) * Math.cos(lambda1)) + (Math.sin(lambda1) * Math.sin(lambda2))))));
}
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) tmp = 0 if (phi2 <= -1.8e-5) or not (phi2 <= 7.4e-93): tmp = math.atan2(t_1, (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_1, (t_0 - (math.sin(phi1) * ((math.cos(lambda2) * math.cos(lambda1)) + (math.sin(lambda1) * math.sin(lambda2)))))) 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)) tmp = 0.0 if ((phi2 <= -1.8e-5) || !(phi2 <= 7.4e-93)) tmp = atan(t_1, Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * Float64(Float64(cos(lambda2) * cos(lambda1)) + Float64(sin(lambda1) * sin(lambda2)))))); 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); tmp = 0.0; if ((phi2 <= -1.8e-5) || ~((phi2 <= 7.4e-93))) tmp = atan2(t_1, (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); else tmp = atan2(t_1, (t_0 - (sin(phi1) * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(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, -1.8e-5], N[Not[LessEqual[phi2, 7.4e-93]], $MachinePrecision]], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \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 -1.8 \cdot 10^{-5} \lor \neg \left(\phi_2 \leq 7.4 \cdot 10^{-93}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -1.80000000000000005e-5 or 7.40000000000000005e-93 < phi2 Initial program 80.7%
sin-diff92.1%
Applied egg-rr92.1%
if -1.80000000000000005e-5 < phi2 < 7.40000000000000005e-93Initial program 82.5%
sin-diff89.2%
Applied egg-rr89.2%
cos-diff83.0%
+-commutative83.0%
*-commutative83.0%
Applied egg-rr99.9%
Taylor expanded in phi2 around 0 99.9%
Final simplification95.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda2 -26500000.0) (not (<= lambda2 6.6e-19)))
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda2) t_1)))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
t_0
(*
t_1
(+
(* (cos lambda2) (cos lambda1))
(* (sin lambda1) (sin lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda2 <= -26500000.0) || !(lambda2 <= 6.6e-19)) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * t_1)));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
if ((lambda2 <= (-26500000.0d0)) .or. (.not. (lambda2 <= 6.6d-19))) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * t_1)))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda2 <= -26500000.0) || !(lambda2 <= 6.6e-19)) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * 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 - (t_1 * ((Math.cos(lambda2) * Math.cos(lambda1)) + (Math.sin(lambda1) * Math.sin(lambda2))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda2 <= -26500000.0) or not (lambda2 <= 6.6e-19): tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * 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 - (t_1 * ((math.cos(lambda2) * math.cos(lambda1)) + (math.sin(lambda1) * math.sin(lambda2)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda2 <= -26500000.0) || !(lambda2 <= 6.6e-19)) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda2) * t_1))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(t_1 * Float64(Float64(cos(lambda2) * cos(lambda1)) + Float64(sin(lambda1) * sin(lambda2)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda2 <= -26500000.0) || ~((lambda2 <= 6.6e-19))) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * t_1))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * ((cos(lambda2) * cos(lambda1)) + (sin(lambda1) * sin(lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda2, -26500000.0], N[Not[LessEqual[lambda2, 6.6e-19]], $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[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[(t$95$1 * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_2 \leq -26500000 \lor \neg \left(\lambda_2 \leq 6.6 \cdot 10^{-19}\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_2 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - t\_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\end{array}
\end{array}
if lambda2 < -2.65e7 or 6.5999999999999995e-19 < lambda2 Initial program 64.3%
sin-diff83.2%
Applied egg-rr83.2%
Taylor expanded in lambda1 around 0 83.0%
cos-neg36.7%
Simplified83.0%
if -2.65e7 < lambda2 < 6.5999999999999995e-19Initial program 98.3%
cos-diff98.5%
+-commutative98.5%
*-commutative98.5%
Applied egg-rr98.5%
Final simplification90.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (or (<= lambda1 -0.09) (not (<= lambda1 2.22e-7)))
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda1) t_1)))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* t_1 (+ (cos lambda2) (* lambda1 (sin lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if ((lambda1 <= -0.09) || !(lambda1 <= 2.22e-7)) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1)));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
if ((lambda1 <= (-0.09d0)) .or. (.not. (lambda1 <= 2.22d-7))) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1)))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if ((lambda1 <= -0.09) || !(lambda1 <= 2.22e-7)) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (Math.cos(lambda1) * t_1)));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (t_1 * (Math.cos(lambda2) + (lambda1 * Math.sin(lambda2))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) tmp = 0 if (lambda1 <= -0.09) or not (lambda1 <= 2.22e-7): tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (math.cos(lambda1) * t_1))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (t_1 * (math.cos(lambda2) + (lambda1 * math.sin(lambda2)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if ((lambda1 <= -0.09) || !(lambda1 <= 2.22e-7)) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * t_1))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(t_1 * Float64(cos(lambda2) + Float64(lambda1 * sin(lambda2)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); tmp = 0.0; if ((lambda1 <= -0.09) || ~((lambda1 <= 2.22e-7))) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * (cos(lambda2) + (lambda1 * sin(lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -0.09], N[Not[LessEqual[lambda1, 2.22e-7]], $MachinePrecision]], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[(N[Cos[lambda2], $MachinePrecision] + N[(lambda1 * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_1 \leq -0.09 \lor \neg \left(\lambda_1 \leq 2.22 \cdot 10^{-7}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - t\_1 \cdot \left(\cos \lambda_2 + \lambda_1 \cdot \sin \lambda_2\right)}\\
\end{array}
\end{array}
if lambda1 < -0.089999999999999997 or 2.22e-7 < lambda1 Initial program 64.2%
sin-diff82.7%
Applied egg-rr82.7%
Taylor expanded in lambda2 around 0 82.6%
if -0.089999999999999997 < lambda1 < 2.22e-7Initial program 99.0%
Taylor expanded in lambda1 around 0 99.1%
cos-neg83.4%
mul-1-neg83.4%
distribute-rgt-neg-in83.4%
sin-neg83.4%
remove-double-neg83.4%
Simplified99.1%
Final simplification90.8%
(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 (<= lambda1 -180.0) (not (<= lambda1 8.8e-5)))
(atan2 t_1 (- t_0 (* (cos lambda1) t_2)))
(atan2 t_1 (- t_0 (* (cos lambda2) 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 ((lambda1 <= -180.0) || !(lambda1 <= 8.8e-5)) {
tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2)));
} else {
tmp = atan2(t_1, (t_0 - (cos(lambda2) * 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 ((lambda1 <= (-180.0d0)) .or. (.not. (lambda1 <= 8.8d-5))) then
tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2)))
else
tmp = atan2(t_1, (t_0 - (cos(lambda2) * 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 ((lambda1 <= -180.0) || !(lambda1 <= 8.8e-5)) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(lambda1) * t_2)));
} else {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(lambda2) * 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 (lambda1 <= -180.0) or not (lambda1 <= 8.8e-5): tmp = math.atan2(t_1, (t_0 - (math.cos(lambda1) * t_2))) else: tmp = math.atan2(t_1, (t_0 - (math.cos(lambda2) * 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 ((lambda1 <= -180.0) || !(lambda1 <= 8.8e-5)) tmp = atan(t_1, Float64(t_0 - Float64(cos(lambda1) * t_2))); else tmp = atan(t_1, Float64(t_0 - Float64(cos(lambda2) * 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 ((lambda1 <= -180.0) || ~((lambda1 <= 8.8e-5))) tmp = atan2(t_1, (t_0 - (cos(lambda1) * t_2))); else tmp = atan2(t_1, (t_0 - (cos(lambda2) * 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[lambda1, -180.0], N[Not[LessEqual[lambda1, 8.8e-5]], $MachinePrecision]], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[lambda2], $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_1 \leq -180 \lor \neg \left(\lambda_1 \leq 8.8 \cdot 10^{-5}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \lambda_1 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \lambda_2 \cdot t\_2}\\
\end{array}
\end{array}
if lambda1 < -180 or 8.7999999999999998e-5 < lambda1 Initial program 64.7%
sin-diff82.5%
Applied egg-rr82.5%
Taylor expanded in lambda2 around 0 82.5%
if -180 < lambda1 < 8.7999999999999998e-5Initial program 98.2%
sin-diff99.1%
Applied egg-rr99.1%
Taylor expanded in lambda1 around 0 99.1%
cos-neg57.3%
Simplified99.1%
Final simplification90.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.5%
sin-diff90.8%
Applied egg-rr90.8%
Final simplification90.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (- t_1 (* (* (cos phi2) (sin phi1)) t_0)))
(t_3 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -5.6e-5)
(atan2 (* (cos phi2) (expm1 (log1p (sin (- lambda1 lambda2))))) t_2)
(if (<= phi1 5e-48)
(atan2
(* (- (* (sin lambda1) (cos lambda2)) t_3) (cos phi2))
(- t_1 (* t_0 (* (cos phi2) phi1))))
(atan2 (* (cos phi2) (- (sin lambda1) t_3)) t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = cos(phi1) * sin(phi2);
double t_2 = t_1 - ((cos(phi2) * sin(phi1)) * t_0);
double t_3 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -5.6e-5) {
tmp = atan2((cos(phi2) * expm1(log1p(sin((lambda1 - lambda2))))), t_2);
} else if (phi1 <= 5e-48) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - t_3) * cos(phi2)), (t_1 - (t_0 * (cos(phi2) * phi1))));
} else {
tmp = atan2((cos(phi2) * (sin(lambda1) - t_3)), t_2);
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double t_2 = t_1 - ((Math.cos(phi2) * Math.sin(phi1)) * t_0);
double t_3 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if (phi1 <= -5.6e-5) {
tmp = Math.atan2((Math.cos(phi2) * Math.expm1(Math.log1p(Math.sin((lambda1 - lambda2))))), t_2);
} else if (phi1 <= 5e-48) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - t_3) * Math.cos(phi2)), (t_1 - (t_0 * (Math.cos(phi2) * phi1))));
} else {
tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_3)), t_2);
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.cos(phi1) * math.sin(phi2) t_2 = t_1 - ((math.cos(phi2) * math.sin(phi1)) * t_0) t_3 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if phi1 <= -5.6e-5: tmp = math.atan2((math.cos(phi2) * math.expm1(math.log1p(math.sin((lambda1 - lambda2))))), t_2) elif phi1 <= 5e-48: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - t_3) * math.cos(phi2)), (t_1 - (t_0 * (math.cos(phi2) * phi1)))) else: tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_3)), t_2) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(t_1 - Float64(Float64(cos(phi2) * sin(phi1)) * t_0)) t_3 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -5.6e-5) tmp = atan(Float64(cos(phi2) * expm1(log1p(sin(Float64(lambda1 - lambda2))))), t_2); elseif (phi1 <= 5e-48) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - t_3) * cos(phi2)), Float64(t_1 - Float64(t_0 * Float64(cos(phi2) * phi1)))); else tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_3)), t_2); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -5.6e-5], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(Exp[N[Log[1 + N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision], If[LessEqual[phi1, 5e-48], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$0 * N[(N[Cos[phi2], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := t\_1 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_0\\
t_3 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -5.6 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\lambda_1 - \lambda_2\right)\right)\right)}{t\_2}\\
\mathbf{elif}\;\phi_1 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_3\right) \cdot \cos \phi_2}{t\_1 - t\_0 \cdot \left(\cos \phi_2 \cdot \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_3\right)}{t\_2}\\
\end{array}
\end{array}
if phi1 < -5.59999999999999992e-5Initial program 81.9%
expm1-log1p-u81.9%
Applied egg-rr81.9%
if -5.59999999999999992e-5 < phi1 < 4.9999999999999999e-48Initial program 82.8%
sin-diff99.9%
Applied egg-rr99.9%
Taylor expanded in phi1 around 0 99.9%
if 4.9999999999999999e-48 < phi1 Initial program 78.6%
sin-diff81.3%
Applied egg-rr81.3%
Taylor expanded in lambda2 around 0 79.0%
Final simplification90.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (- t_1 (* (* (cos phi2) (sin phi1)) t_0)))
(t_3 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -1.6e-10)
(atan2 (* (cos phi2) (expm1 (log1p (sin (- lambda1 lambda2))))) t_2)
(if (<= phi1 2e-52)
(atan2
(* (- (* (sin lambda1) (cos lambda2)) t_3) (cos phi2))
(- t_1 (* phi1 t_0)))
(atan2 (* (cos phi2) (- (sin lambda1) t_3)) t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = cos(phi1) * sin(phi2);
double t_2 = t_1 - ((cos(phi2) * sin(phi1)) * t_0);
double t_3 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -1.6e-10) {
tmp = atan2((cos(phi2) * expm1(log1p(sin((lambda1 - lambda2))))), t_2);
} else if (phi1 <= 2e-52) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - t_3) * cos(phi2)), (t_1 - (phi1 * t_0)));
} else {
tmp = atan2((cos(phi2) * (sin(lambda1) - t_3)), t_2);
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double t_2 = t_1 - ((Math.cos(phi2) * Math.sin(phi1)) * t_0);
double t_3 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if (phi1 <= -1.6e-10) {
tmp = Math.atan2((Math.cos(phi2) * Math.expm1(Math.log1p(Math.sin((lambda1 - lambda2))))), t_2);
} else if (phi1 <= 2e-52) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - t_3) * Math.cos(phi2)), (t_1 - (phi1 * t_0)));
} else {
tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_3)), t_2);
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.cos(phi1) * math.sin(phi2) t_2 = t_1 - ((math.cos(phi2) * math.sin(phi1)) * t_0) t_3 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if phi1 <= -1.6e-10: tmp = math.atan2((math.cos(phi2) * math.expm1(math.log1p(math.sin((lambda1 - lambda2))))), t_2) elif phi1 <= 2e-52: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - t_3) * math.cos(phi2)), (t_1 - (phi1 * t_0))) else: tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_3)), t_2) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(t_1 - Float64(Float64(cos(phi2) * sin(phi1)) * t_0)) t_3 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -1.6e-10) tmp = atan(Float64(cos(phi2) * expm1(log1p(sin(Float64(lambda1 - lambda2))))), t_2); elseif (phi1 <= 2e-52) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - t_3) * cos(phi2)), Float64(t_1 - Float64(phi1 * t_0))); else tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_3)), t_2); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -1.6e-10], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(Exp[N[Log[1 + N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision], If[LessEqual[phi1, 2e-52], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(phi1 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := t\_1 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_0\\
t_3 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -1.6 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\lambda_1 - \lambda_2\right)\right)\right)}{t\_2}\\
\mathbf{elif}\;\phi_1 \leq 2 \cdot 10^{-52}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_3\right) \cdot \cos \phi_2}{t\_1 - \phi_1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_3\right)}{t\_2}\\
\end{array}
\end{array}
if phi1 < -1.5999999999999999e-10Initial program 82.2%
expm1-log1p-u82.2%
Applied egg-rr82.2%
if -1.5999999999999999e-10 < phi1 < 2e-52Initial program 82.7%
sin-diff99.9%
Applied egg-rr99.9%
Taylor expanded in phi1 around 0 99.9%
Taylor expanded in phi2 around 0 99.9%
if 2e-52 < phi1 Initial program 78.6%
sin-diff81.3%
Applied egg-rr81.3%
Taylor expanded in lambda2 around 0 79.0%
Final simplification90.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (cos (- lambda1 lambda2)))
(t_3 (sin (- lambda1 lambda2))))
(if (<= phi1 -4.1e-10)
(atan2 (* (cos phi2) (expm1 (log1p t_3))) (- t_0 (* t_1 t_2)))
(if (<= phi1 1.72e-47)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* phi1 t_2)))
(atan2 (* (cos phi2) t_3) (- t_0 (* t_2 (log1p (expm1 t_1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos((lambda1 - lambda2));
double t_3 = sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -4.1e-10) {
tmp = atan2((cos(phi2) * expm1(log1p(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.72e-47) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (phi1 * t_2)));
} else {
tmp = atan2((cos(phi2) * t_3), (t_0 - (t_2 * log1p(expm1(t_1)))));
}
return tmp;
}
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos((lambda1 - lambda2));
double t_3 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -4.1e-10) {
tmp = Math.atan2((Math.cos(phi2) * Math.expm1(Math.log1p(t_3))), (t_0 - (t_1 * t_2)));
} else if (phi1 <= 1.72e-47) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (phi1 * t_2)));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_3), (t_0 - (t_2 * Math.log1p(Math.expm1(t_1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos((lambda1 - lambda2)) t_3 = math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -4.1e-10: tmp = math.atan2((math.cos(phi2) * math.expm1(math.log1p(t_3))), (t_0 - (t_1 * t_2))) elif phi1 <= 1.72e-47: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (phi1 * t_2))) else: tmp = math.atan2((math.cos(phi2) * t_3), (t_0 - (t_2 * math.log1p(math.expm1(t_1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = cos(Float64(lambda1 - lambda2)) t_3 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -4.1e-10) tmp = atan(Float64(cos(phi2) * expm1(log1p(t_3))), Float64(t_0 - Float64(t_1 * t_2))); elseif (phi1 <= 1.72e-47) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(phi1 * t_2))); else tmp = atan(Float64(cos(phi2) * t_3), Float64(t_0 - Float64(t_2 * log1p(expm1(t_1))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -4.1e-10], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(Exp[N[Log[1 + t$95$3], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.72e-47], 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[(phi1 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * N[Log[1 + N[(Exp[t$95$1] - 1), $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\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_3 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -4.1 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_3\right)\right)}{t\_0 - t\_1 \cdot t\_2}\\
\mathbf{elif}\;\phi_1 \leq 1.72 \cdot 10^{-47}:\\
\;\;\;\;\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 - \phi_1 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_3}{t\_0 - t\_2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -4.0999999999999998e-10Initial program 82.2%
expm1-log1p-u82.2%
Applied egg-rr82.2%
if -4.0999999999999998e-10 < phi1 < 1.72e-47Initial program 82.7%
sin-diff99.9%
Applied egg-rr99.9%
Taylor expanded in phi1 around 0 99.9%
Taylor expanded in phi2 around 0 99.9%
if 1.72e-47 < phi1 Initial program 78.6%
log1p-expm1-u78.6%
Applied egg-rr78.6%
Final simplification89.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (sin (- lambda1 lambda2))))
(if (<= phi1 -7e-10)
(atan2
(* (cos phi2) (expm1 (log1p t_2)))
(- t_0 (* (* (cos phi2) (sin phi1)) t_1)))
(if (<= phi1 1.5e-47)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* phi1 t_1)))
(atan2 (* (cos phi2) t_2) (- 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((lambda1 - lambda2));
double tmp;
if (phi1 <= -7e-10) {
tmp = atan2((cos(phi2) * expm1(log1p(t_2))), (t_0 - ((cos(phi2) * sin(phi1)) * t_1)));
} else if (phi1 <= 1.5e-47) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (phi1 * t_1)));
} else {
tmp = atan2((cos(phi2) * t_2), (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((lambda1 - lambda2));
double tmp;
if (phi1 <= -7e-10) {
tmp = Math.atan2((Math.cos(phi2) * Math.expm1(Math.log1p(t_2))), (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * t_1)));
} else if (phi1 <= 1.5e-47) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (phi1 * t_1)));
} else {
tmp = Math.atan2((Math.cos(phi2) * t_2), (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((lambda1 - lambda2)) tmp = 0 if phi1 <= -7e-10: tmp = math.atan2((math.cos(phi2) * math.expm1(math.log1p(t_2))), (t_0 - ((math.cos(phi2) * math.sin(phi1)) * t_1))) elif phi1 <= 1.5e-47: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (phi1 * t_1))) else: tmp = math.atan2((math.cos(phi2) * t_2), (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 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi1 <= -7e-10) tmp = atan(Float64(cos(phi2) * expm1(log1p(t_2))), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * t_1))); elseif (phi1 <= 1.5e-47) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(phi1 * t_1))); else tmp = atan(Float64(cos(phi2) * t_2), Float64(t_0 - Float64(cos(phi2) * Float64(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[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -7e-10], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(Exp[N[Log[1 + t$95$2], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.5e-47], 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[(phi1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$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 \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -7 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t\_2\right)\right)}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_1}\\
\mathbf{elif}\;\phi_1 \leq 1.5 \cdot 10^{-47}:\\
\;\;\;\;\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 - \phi_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_2}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\
\end{array}
\end{array}
if phi1 < -6.99999999999999961e-10Initial program 82.2%
expm1-log1p-u82.2%
Applied egg-rr82.2%
if -6.99999999999999961e-10 < phi1 < 1.50000000000000008e-47Initial program 82.7%
sin-diff99.9%
Applied egg-rr99.9%
Taylor expanded in phi1 around 0 99.9%
Taylor expanded in phi2 around 0 99.9%
if 1.50000000000000008e-47 < phi1 Initial program 78.6%
*-commutative78.6%
associate-*l*78.6%
Simplified78.6%
Final simplification89.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (cos (- lambda1 lambda2))))
(if (or (<= phi1 -2.5e-10) (not (<= phi1 2e-52)))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos phi2) (* (sin phi1) t_1))))
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* phi1 t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -2.5e-10) || !(phi1 <= 2e-52)) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
} else {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (phi1 * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
if ((phi1 <= (-2.5d-10)) .or. (.not. (phi1 <= 2d-52))) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * t_1))))
else
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (phi1 * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos((lambda1 - lambda2));
double tmp;
if ((phi1 <= -2.5e-10) || !(phi1 <= 2e-52)) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * t_1))));
} else {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (phi1 * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos((lambda1 - lambda2)) tmp = 0 if (phi1 <= -2.5e-10) or not (phi1 <= 2e-52): tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(phi2) * (math.sin(phi1) * t_1)))) else: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (phi1 * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) tmp = 0.0 if ((phi1 <= -2.5e-10) || !(phi1 <= 2e-52)) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * t_1)))); else tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(phi1 * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos((lambda1 - lambda2)); tmp = 0.0; if ((phi1 <= -2.5e-10) || ~((phi1 <= 2e-52))) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * t_1)))); else tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (phi1 * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi1, -2.5e-10], N[Not[LessEqual[phi1, 2e-52]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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[(phi1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{-10} \lor \neg \left(\phi_1 \leq 2 \cdot 10^{-52}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\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 - \phi_1 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -2.50000000000000016e-10 or 2e-52 < phi1 Initial program 80.3%
*-commutative80.3%
associate-*l*80.3%
Simplified80.3%
if -2.50000000000000016e-10 < phi1 < 2e-52Initial program 82.7%
sin-diff99.9%
Applied egg-rr99.9%
Taylor expanded in phi1 around 0 99.9%
Taylor expanded in phi2 around 0 99.9%
Final simplification89.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (or (<= phi2 -4.6e-33) (not (<= phi2 1.5e-11)))
(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 <= -4.6e-33) || !(phi2 <= 1.5e-11)) {
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 <= (-4.6d-33)) .or. (.not. (phi2 <= 1.5d-11))) 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 <= -4.6e-33) || !(phi2 <= 1.5e-11)) {
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 <= -4.6e-33) or not (phi2 <= 1.5e-11): 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 <= -4.6e-33) || !(phi2 <= 1.5e-11)) 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 <= -4.6e-33) || ~((phi2 <= 1.5e-11))) 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, -4.6e-33], N[Not[LessEqual[phi2, 1.5e-11]], $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 -4.6 \cdot 10^{-33} \lor \neg \left(\phi_2 \leq 1.5 \cdot 10^{-11}\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 < -4.59999999999999971e-33 or 1.5e-11 < phi2 Initial program 81.9%
*-commutative81.9%
associate-*l*81.9%
Simplified81.9%
if -4.59999999999999971e-33 < phi2 < 1.5e-11Initial program 80.9%
Taylor expanded in phi2 around 0 80.9%
Taylor expanded in phi2 around 0 80.9%
Taylor expanded in phi1 around 0 80.9%
sin-diff90.6%
Applied egg-rr90.6%
Final simplification85.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))))
(if (or (<= lambda1 -0.12) (not (<= lambda1 0.026)))
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos lambda2) (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double tmp;
if ((lambda1 <= -0.12) || !(lambda1 <= 0.026)) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (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(phi1) * sin(phi2)
if ((lambda1 <= (-0.12d0)) .or. (.not. (lambda1 <= 0.026d0))) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (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(phi1) * Math.sin(phi2);
double tmp;
if ((lambda1 <= -0.12) || !(lambda1 <= 0.026)) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(lambda2) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) tmp = 0 if (lambda1 <= -0.12) or not (lambda1 <= 0.026): tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(lambda2) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if ((lambda1 <= -0.12) || !(lambda1 <= 0.026)) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(lambda2) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); tmp = 0.0; if ((lambda1 <= -0.12) || ~((lambda1 <= 0.026))) tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(lambda2) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -0.12], N[Not[LessEqual[lambda1, 0.026]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.12 \lor \neg \left(\lambda_1 \leq 0.026\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \cos \lambda_2 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda1 < -0.12 or 0.0259999999999999988 < lambda1 Initial program 64.4%
Taylor expanded in lambda2 around 0 65.4%
if -0.12 < lambda1 < 0.0259999999999999988Initial program 98.5%
Taylor expanded in phi2 around 0 83.0%
Taylor expanded in lambda1 around 0 83.0%
cos-neg57.3%
Simplified83.0%
Final simplification74.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))))
(if (or (<= lambda1 -0.092) (not (<= lambda1 0.015)))
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos phi2) (* (cos lambda2) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double tmp;
if ((lambda1 <= -0.092) || !(lambda1 <= 0.015)) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(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(phi1) * sin(phi2)
if ((lambda1 <= (-0.092d0)) .or. (.not. (lambda1 <= 0.015d0))) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
else
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(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(phi1) * Math.sin(phi2);
double tmp;
if ((lambda1 <= -0.092) || !(lambda1 <= 0.015)) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(phi2) * (Math.cos(lambda2) * Math.sin(phi1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) tmp = 0 if (lambda1 <= -0.092) or not (lambda1 <= 0.015): tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(phi2) * (math.cos(lambda2) * math.sin(phi1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if ((lambda1 <= -0.092) || !(lambda1 <= 0.015)) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(phi2) * Float64(cos(lambda2) * sin(phi1))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); tmp = 0.0; if ((lambda1 <= -0.092) || ~((lambda1 <= 0.015))) tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); else tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (cos(lambda2) * sin(phi1))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[lambda1, -0.092], N[Not[LessEqual[lambda1, 0.015]], $MachinePrecision]], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.092 \lor \neg \left(\lambda_1 \leq 0.015\right):\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \phi_1\right)}\\
\end{array}
\end{array}
if lambda1 < -0.091999999999999998 or 0.014999999999999999 < lambda1 Initial program 64.4%
Taylor expanded in lambda2 around 0 65.4%
if -0.091999999999999998 < lambda1 < 0.014999999999999999Initial program 98.5%
*-commutative98.5%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in lambda1 around 0 98.5%
*-commutative98.5%
cos-neg98.5%
Simplified98.5%
Final simplification81.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))))
(if (<= lambda1 -0.6)
(atan2
(* (sin lambda1) (cos phi2))
(- t_2 (* t_0 (cos (- lambda1 lambda2)))))
(if (<= lambda1 6.1e-6)
(atan2 t_1 (- t_2 (* (cos phi2) (* (cos lambda2) (sin phi1)))))
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double t_2 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -0.6) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 6.1e-6) {
tmp = atan2(t_1, (t_2 - (cos(phi2) * (cos(lambda2) * sin(phi1)))));
} else {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi2) * sin(phi1)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
t_2 = cos(phi1) * sin(phi2)
if (lambda1 <= (-0.6d0)) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2)))))
else if (lambda1 <= 6.1d-6) then
tmp = atan2(t_1, (t_2 - (cos(phi2) * (cos(lambda2) * sin(phi1)))))
else
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi2) * Math.sin(phi1);
double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double t_2 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -0.6) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_2 - (t_0 * Math.cos((lambda1 - lambda2)))));
} else if (lambda1 <= 6.1e-6) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(phi2) * (Math.cos(lambda2) * Math.sin(phi1)))));
} else {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin(phi1) t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2)) t_2 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -0.6: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_2 - (t_0 * math.cos((lambda1 - lambda2))))) elif lambda1 <= 6.1e-6: tmp = math.atan2(t_1, (t_2 - (math.cos(phi2) * (math.cos(lambda2) * math.sin(phi1))))) else: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_2 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -0.6) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_2 - Float64(t_0 * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 6.1e-6) tmp = atan(t_1, Float64(t_2 - Float64(cos(phi2) * Float64(cos(lambda2) * sin(phi1))))); else tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin(phi1); t_1 = cos(phi2) * sin((lambda1 - lambda2)); t_2 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -0.6) tmp = atan2((sin(lambda1) * cos(phi2)), (t_2 - (t_0 * cos((lambda1 - lambda2))))); elseif (lambda1 <= 6.1e-6) tmp = atan2(t_1, (t_2 - (cos(phi2) * (cos(lambda2) * sin(phi1))))); else tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -0.6], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(t$95$0 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 6.1e-6], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.6:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_2 - t\_0 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 6.1 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\end{array}
\end{array}
if lambda1 < -0.599999999999999978Initial program 66.5%
Taylor expanded in lambda2 around 0 69.4%
if -0.599999999999999978 < lambda1 < 6.10000000000000004e-6Initial program 99.0%
*-commutative99.0%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in lambda1 around 0 99.0%
*-commutative99.0%
cos-neg99.0%
Simplified99.0%
if 6.10000000000000004e-6 < lambda1 Initial program 62.2%
Taylor expanded in lambda2 around 0 62.1%
Final simplification82.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (sin (- lambda1 lambda2)))
(t_2 (* (cos phi2) t_1)))
(if (<= phi2 -0.052)
(atan2 t_2 (- t_0 (sin phi1)))
(if (<= phi2 1.28e-39)
(atan2
t_1
(- (* phi2 (cos phi1)) (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2 t_2 (- t_0 (* (cos lambda1) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin((lambda1 - lambda2));
double t_2 = cos(phi2) * t_1;
double tmp;
if (phi2 <= -0.052) {
tmp = atan2(t_2, (t_0 - sin(phi1)));
} else if (phi2 <= 1.28e-39) {
tmp = atan2(t_1, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_2, (t_0 - (cos(lambda1) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = sin((lambda1 - lambda2))
t_2 = cos(phi2) * t_1
if (phi2 <= (-0.052d0)) then
tmp = atan2(t_2, (t_0 - sin(phi1)))
else if (phi2 <= 1.28d-39) then
tmp = atan2(t_1, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_2, (t_0 - (cos(lambda1) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin((lambda1 - lambda2));
double t_2 = Math.cos(phi2) * t_1;
double tmp;
if (phi2 <= -0.052) {
tmp = Math.atan2(t_2, (t_0 - Math.sin(phi1)));
} else if (phi2 <= 1.28e-39) {
tmp = Math.atan2(t_1, ((phi2 * Math.cos(phi1)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_2, (t_0 - (Math.cos(lambda1) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin((lambda1 - lambda2)) t_2 = math.cos(phi2) * t_1 tmp = 0 if phi2 <= -0.052: tmp = math.atan2(t_2, (t_0 - math.sin(phi1))) elif phi2 <= 1.28e-39: tmp = math.atan2(t_1, ((phi2 * math.cos(phi1)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_2, (t_0 - (math.cos(lambda1) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = sin(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * t_1) tmp = 0.0 if (phi2 <= -0.052) tmp = atan(t_2, Float64(t_0 - sin(phi1))); elseif (phi2 <= 1.28e-39) tmp = atan(t_1, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_2, Float64(t_0 - Float64(cos(lambda1) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = sin((lambda1 - lambda2)); t_2 = cos(phi2) * t_1; tmp = 0.0; if (phi2 <= -0.052) tmp = atan2(t_2, (t_0 - sin(phi1))); elseif (phi2 <= 1.28e-39) tmp = atan2(t_1, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = atan2(t_2, (t_0 - (cos(lambda1) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[phi2, -0.052], N[ArcTan[t$95$2 / N[(t$95$0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 1.28e-39], N[ArcTan[t$95$1 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot t\_1\\
\mathbf{if}\;\phi_2 \leq -0.052:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \sin \phi_1}\\
\mathbf{elif}\;\phi_2 \leq 1.28 \cdot 10^{-39}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \cos \lambda_1 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if phi2 < -0.0519999999999999976Initial program 85.7%
Taylor expanded in phi2 around 0 57.3%
Taylor expanded in lambda1 around 0 53.8%
cos-neg53.8%
mul-1-neg53.8%
distribute-rgt-neg-in53.8%
sin-neg53.8%
remove-double-neg53.8%
Simplified53.8%
Taylor expanded in lambda2 around 0 57.5%
if -0.0519999999999999976 < phi2 < 1.28000000000000001e-39Initial program 81.3%
Taylor expanded in phi2 around 0 81.2%
Taylor expanded in phi2 around 0 81.3%
Taylor expanded in phi2 around 0 81.3%
if 1.28000000000000001e-39 < phi2 Initial program 77.0%
Taylor expanded in phi2 around 0 57.2%
Taylor expanded in lambda2 around 0 57.4%
Final simplification68.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_1 (* (cos phi1) (sin phi2))))
(if (<= lambda1 -0.58)
(atan2
(* (sin lambda1) (cos phi2))
(- t_1 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (<= lambda1 0.00102)
(atan2 t_0 (- t_1 (* (cos lambda2) (sin phi1))))
(atan2 t_0 (- t_1 (* (cos lambda1) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin((lambda1 - lambda2));
double t_1 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -0.58) {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_1 - (sin(phi1) * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 0.00102) {
tmp = atan2(t_0, (t_1 - (cos(lambda2) * sin(phi1))));
} else {
tmp = atan2(t_0, (t_1 - (cos(lambda1) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi2) * sin((lambda1 - lambda2))
t_1 = cos(phi1) * sin(phi2)
if (lambda1 <= (-0.58d0)) then
tmp = atan2((sin(lambda1) * cos(phi2)), (t_1 - (sin(phi1) * cos((lambda1 - lambda2)))))
else if (lambda1 <= 0.00102d0) then
tmp = atan2(t_0, (t_1 - (cos(lambda2) * sin(phi1))))
else
tmp = atan2(t_0, (t_1 - (cos(lambda1) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -0.58) {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_1 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else if (lambda1 <= 0.00102) {
tmp = Math.atan2(t_0, (t_1 - (Math.cos(lambda2) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_0, (t_1 - (Math.cos(lambda1) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin((lambda1 - lambda2)) t_1 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -0.58: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_1 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) elif lambda1 <= 0.00102: tmp = math.atan2(t_0, (t_1 - (math.cos(lambda2) * math.sin(phi1)))) else: tmp = math.atan2(t_0, (t_1 - (math.cos(lambda1) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_1 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -0.58) tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_1 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 0.00102) tmp = atan(t_0, Float64(t_1 - Float64(cos(lambda2) * sin(phi1)))); else tmp = atan(t_0, Float64(t_1 - Float64(cos(lambda1) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin((lambda1 - lambda2)); t_1 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -0.58) tmp = atan2((sin(lambda1) * cos(phi2)), (t_1 - (sin(phi1) * cos((lambda1 - lambda2))))); elseif (lambda1 <= 0.00102) tmp = atan2(t_0, (t_1 - (cos(lambda2) * sin(phi1)))); else tmp = atan2(t_0, (t_1 - (cos(lambda1) * 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]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -0.58], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.00102], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[Cos[lambda1], $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)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.58:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 0.00102:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \cos \lambda_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \cos \lambda_1 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda1 < -0.57999999999999996Initial program 66.5%
Taylor expanded in phi2 around 0 58.6%
Taylor expanded in lambda2 around 0 61.5%
if -0.57999999999999996 < lambda1 < 0.00102Initial program 99.0%
Taylor expanded in phi2 around 0 83.4%
Taylor expanded in lambda1 around 0 83.4%
cos-neg57.8%
Simplified83.4%
if 0.00102 < lambda1 Initial program 62.2%
Taylor expanded in phi2 around 0 49.3%
Taylor expanded in lambda2 around 0 49.4%
Final simplification69.1%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[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)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.5%
Taylor expanded in phi2 around 0 68.4%
Final simplification68.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (or (<= phi2 -0.052) (not (<= phi2 5e-8)))
(atan2 (* (cos phi2) t_0) (- (* (cos phi1) (sin phi2)) (sin phi1)))
(atan2
t_0
(- (* phi2 (cos phi1)) (* (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.052) || !(phi2 <= 5e-8)) {
tmp = atan2((cos(phi2) * t_0), ((cos(phi1) * sin(phi2)) - sin(phi1)));
} else {
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (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.052d0)) .or. (.not. (phi2 <= 5d-8))) then
tmp = atan2((cos(phi2) * t_0), ((cos(phi1) * sin(phi2)) - sin(phi1)))
else
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (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.052) || !(phi2 <= 5e-8)) {
tmp = Math.atan2((Math.cos(phi2) * t_0), ((Math.cos(phi1) * Math.sin(phi2)) - Math.sin(phi1)));
} else {
tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (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.052) or not (phi2 <= 5e-8): tmp = math.atan2((math.cos(phi2) * t_0), ((math.cos(phi1) * math.sin(phi2)) - math.sin(phi1))) else: tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (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.052) || !(phi2 <= 5e-8)) tmp = atan(Float64(cos(phi2) * t_0), Float64(Float64(cos(phi1) * sin(phi2)) - sin(phi1))); else tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - 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.052) || ~((phi2 <= 5e-8))) tmp = atan2((cos(phi2) * t_0), ((cos(phi1) * sin(phi2)) - sin(phi1))); else tmp = atan2(t_0, ((phi2 * cos(phi1)) - (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.052], N[Not[LessEqual[phi2, 5e-8]], $MachinePrecision]], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[Sin[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $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.052 \lor \neg \left(\phi_2 \leq 5 \cdot 10^{-8}\right):\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if phi2 < -0.0519999999999999976 or 4.9999999999999998e-8 < phi2 Initial program 81.5%
Taylor expanded in phi2 around 0 56.1%
Taylor expanded in lambda1 around 0 52.9%
cos-neg52.9%
mul-1-neg52.9%
distribute-rgt-neg-in52.9%
sin-neg52.9%
remove-double-neg52.9%
Simplified52.9%
Taylor expanded in lambda2 around 0 56.0%
if -0.0519999999999999976 < phi2 < 4.9999999999999998e-8Initial program 81.4%
Taylor expanded in phi2 around 0 81.3%
Taylor expanded in phi2 around 0 81.4%
Taylor expanded in phi2 around 0 81.4%
Final simplification68.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 15500000000.0)
(atan2 t_0 (- phi2 (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2 t_0 (- (sin phi2) (* (cos lambda1) (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 15500000000.0) {
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
if (phi2 <= 15500000000.0d0) then
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 15500000000.0) {
tmp = Math.atan2(t_0, (phi2 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos(lambda1) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= 15500000000.0: tmp = math.atan2(t_0, (phi2 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos(lambda1) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= 15500000000.0) tmp = atan(t_0, Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(lambda1) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 15500000000.0) tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = atan2(t_0, (sin(phi2) - (cos(lambda1) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 15500000000.0], 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[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 15500000000:\\
\;\;\;\;\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 - \cos \lambda_1 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if phi2 < 1.55e10Initial program 82.8%
Taylor expanded in phi2 around 0 72.5%
Taylor expanded in phi2 around 0 56.8%
Taylor expanded in phi1 around 0 56.6%
Taylor expanded in phi2 around 0 56.1%
mul-1-neg56.1%
*-commutative56.1%
unsub-neg56.1%
Simplified56.1%
if 1.55e10 < phi2 Initial program 76.6%
Taylor expanded in phi2 around 0 53.6%
Taylor expanded in phi2 around 0 20.9%
Taylor expanded in phi1 around 0 20.2%
Taylor expanded in lambda2 around 0 20.0%
Final simplification48.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 160000000000.0)
(atan2 t_0 (- phi2 (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2 t_0 (- (sin phi2) (* (cos lambda2) (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 160000000000.0) {
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))));
} 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 = sin((lambda1 - lambda2))
if (phi2 <= 160000000000.0d0) then
tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2)))))
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.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 160000000000.0) {
tmp = Math.atan2(t_0, (phi2 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} 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.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= 160000000000.0: tmp = math.atan2(t_0, (phi2 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) 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 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= 160000000000.0) tmp = atan(t_0, Float64(phi2 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); 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 = sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 160000000000.0) tmp = atan2(t_0, (phi2 - (sin(phi1) * cos((lambda1 - lambda2))))); 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[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 160000000000.0], 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[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 160000000000:\\
\;\;\;\;\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 - \cos \lambda_2 \cdot \sin \phi_1}\\
\end{array}
\end{array}
if phi2 < 1.6e11Initial program 82.8%
Taylor expanded in phi2 around 0 72.5%
Taylor expanded in phi2 around 0 56.8%
Taylor expanded in phi1 around 0 56.6%
Taylor expanded in phi2 around 0 56.1%
mul-1-neg56.1%
*-commutative56.1%
unsub-neg56.1%
Simplified56.1%
if 1.6e11 < phi2 Initial program 76.6%
Taylor expanded in phi2 around 0 53.6%
Taylor expanded in phi2 around 0 20.9%
Taylor expanded in phi1 around 0 20.2%
Taylor expanded in lambda1 around 0 20.1%
cos-neg20.1%
Simplified20.1%
Final simplification48.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (- (sin phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), (Math.sin(phi2) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (math.sin(phi2) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(sin(phi2) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (sin(phi2) - (sin(phi1) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 81.5%
Taylor expanded in phi2 around 0 68.4%
Taylor expanded in phi2 around 0 49.0%
Taylor expanded in phi1 around 0 48.6%
Final simplification48.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (or (<= phi1 -2e-9) (not (<= phi1 5.5e+14)))
(atan2 t_0 (* (cos (- lambda1 lambda2)) (- (sin phi1))))
(atan2 t_0 (sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double tmp;
if ((phi1 <= -2e-9) || !(phi1 <= 5.5e+14)) {
tmp = atan2(t_0, (cos((lambda1 - lambda2)) * -sin(phi1)));
} 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 ((phi1 <= (-2d-9)) .or. (.not. (phi1 <= 5.5d+14))) then
tmp = atan2(t_0, (cos((lambda1 - lambda2)) * -sin(phi1)))
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 ((phi1 <= -2e-9) || !(phi1 <= 5.5e+14)) {
tmp = Math.atan2(t_0, (Math.cos((lambda1 - lambda2)) * -Math.sin(phi1)));
} 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 (phi1 <= -2e-9) or not (phi1 <= 5.5e+14): tmp = math.atan2(t_0, (math.cos((lambda1 - lambda2)) * -math.sin(phi1))) 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 ((phi1 <= -2e-9) || !(phi1 <= 5.5e+14)) tmp = atan(t_0, Float64(cos(Float64(lambda1 - lambda2)) * Float64(-sin(phi1)))); 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 ((phi1 <= -2e-9) || ~((phi1 <= 5.5e+14))) tmp = atan2(t_0, (cos((lambda1 - lambda2)) * -sin(phi1))); 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[Or[LessEqual[phi1, -2e-9], N[Not[LessEqual[phi1, 5.5e+14]], $MachinePrecision]], N[ArcTan[t$95$0 / N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * (-N[Sin[phi1], $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_1 \leq -2 \cdot 10^{-9} \lor \neg \left(\phi_1 \leq 5.5 \cdot 10^{+14}\right):\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(-\sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\end{array}
\end{array}
if phi1 < -2.00000000000000012e-9 or 5.5e14 < phi1 Initial program 78.8%
Taylor expanded in phi2 around 0 54.0%
Taylor expanded in phi2 around 0 49.3%
Taylor expanded in phi1 around 0 47.8%
Taylor expanded in phi2 around 0 48.1%
mul-1-neg48.1%
*-commutative48.1%
distribute-rgt-neg-in48.1%
Simplified48.1%
if -2.00000000000000012e-9 < phi1 < 5.5e14Initial program 83.7%
Taylor expanded in phi2 around 0 80.5%
Taylor expanded in phi2 around 0 48.7%
Taylor expanded in phi1 around 0 49.4%
Taylor expanded in phi1 around 0 47.4%
Final simplification47.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2))))
(if (<= phi2 15500000000.0)
(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 <= 15500000000.0) {
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 <= 15500000000.0d0) 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 <= 15500000000.0) {
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 <= 15500000000.0: 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 <= 15500000000.0) 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 <= 15500000000.0) 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, 15500000000.0], 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 15500000000:\\
\;\;\;\;\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.55e10Initial program 82.8%
Taylor expanded in phi2 around 0 72.5%
Taylor expanded in phi2 around 0 56.8%
Taylor expanded in phi1 around 0 56.6%
Taylor expanded in phi2 around 0 56.1%
mul-1-neg56.1%
*-commutative56.1%
unsub-neg56.1%
Simplified56.1%
if 1.55e10 < phi2 Initial program 76.6%
Taylor expanded in phi2 around 0 53.6%
Taylor expanded in phi2 around 0 20.9%
Taylor expanded in phi1 around 0 20.2%
Taylor expanded in phi1 around 0 18.2%
Final simplification47.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), sin(phi2));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
\end{array}
Initial program 81.5%
Taylor expanded in phi2 around 0 68.4%
Taylor expanded in phi2 around 0 49.0%
Taylor expanded in phi1 around 0 48.6%
Taylor expanded in phi1 around 0 32.3%
Final simplification32.3%
herbie shell --seed 2024041
(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))))))