
(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 32 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(fma
(* (cos lambda2) (cos phi2))
(sin lambda1)
(* (sin (- lambda2)) (* (cos phi2) (cos lambda1))))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(fma((cos(lambda2) * cos(phi2)), sin(lambda1), (sin(-lambda2) * (cos(phi2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(fma(Float64(cos(lambda2) * cos(phi2)), sin(lambda1), Float64(sin(Float64(-lambda2)) * Float64(cos(phi2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Sin[(-lambda2)], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\mathsf{fma}\left(\cos \lambda_2 \cdot \cos \phi_2, \sin \lambda_1, \sin \left(-\lambda_2\right) \cdot \left(\cos \phi_2 \cdot \cos \lambda_1\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 82.6%
cos-diffN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6482.8
Applied egg-rr82.8%
lift--.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
Applied egg-rr99.8%
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lift-neg.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-*.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 82.6%
cos-diffN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6482.8
Applied egg-rr82.8%
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift--.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda2) (sin lambda1)))
(t_1 (- t_0 (* (cos lambda1) (sin lambda2))))
(t_2 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(if (<= phi2 -1.9e-5)
(atan2
(fma t_0 (cos phi2) (* (cos phi2) (* (sin (- lambda2)) (cos lambda1))))
(- (* (cos phi1) (sin phi2)) t_2))
(if (<= phi2 5.6e-5)
(atan2
t_1
(fma
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))
(- (sin phi1))
(* phi2 (cos phi1))))
(atan2 (* (cos phi2) t_1) (fma (sin phi2) (cos phi1) (- t_2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda2) * sin(lambda1);
double t_1 = t_0 - (cos(lambda1) * sin(lambda2));
double t_2 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2));
double tmp;
if (phi2 <= -1.9e-5) {
tmp = atan2(fma(t_0, cos(phi2), (cos(phi2) * (sin(-lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - t_2));
} else if (phi2 <= 5.6e-5) {
tmp = atan2(t_1, fma(fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))), -sin(phi1), (phi2 * cos(phi1))));
} else {
tmp = atan2((cos(phi2) * t_1), fma(sin(phi2), cos(phi1), -t_2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda2) * sin(lambda1)) t_1 = Float64(t_0 - Float64(cos(lambda1) * sin(lambda2))) t_2 = Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi2 <= -1.9e-5) tmp = atan(fma(t_0, cos(phi2), Float64(cos(phi2) * Float64(sin(Float64(-lambda2)) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - t_2)); elseif (phi2 <= 5.6e-5) tmp = atan(t_1, fma(fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))), Float64(-sin(phi1)), Float64(phi2 * cos(phi1)))); else tmp = atan(Float64(cos(phi2) * t_1), fma(sin(phi2), cos(phi1), Float64(-t_2))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -1.9e-5], N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 5.6e-5], N[ArcTan[t$95$1 / N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + (-t$95$2)), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \sin \lambda_1\\
t_1 := t\_0 - \cos \lambda_1 \cdot \sin \lambda_2\\
t_2 := \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -1.9 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(t\_0, \cos \phi_2, \cos \phi_2 \cdot \left(\sin \left(-\lambda_2\right) \cdot \cos \lambda_1\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - t\_2}\\
\mathbf{elif}\;\phi_2 \leq 5.6 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right), -\sin \phi_1, \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, -t\_2\right)}\\
\end{array}
\end{array}
if phi2 < -1.9000000000000001e-5Initial program 78.2%
lift--.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.2
Applied egg-rr89.2%
if -1.9000000000000001e-5 < phi2 < 5.59999999999999992e-5Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6483.1
Applied egg-rr83.1%
Taylor expanded in phi2 around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
Simplified83.1%
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift--.f6499.8
Applied egg-rr99.8%
if 5.59999999999999992e-5 < phi2 Initial program 86.9%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6494.6
Applied egg-rr94.6%
Applied egg-rr94.6%
Final simplification96.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(t_1 (* (cos phi2) t_0))
(t_2 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(if (<= phi2 -5e-5)
(atan2 t_1 (- (* (cos phi1) (sin phi2)) t_2))
(if (<= phi2 6e-5)
(atan2
t_0
(fma
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))
(- (sin phi1))
(* phi2 (cos phi1))))
(atan2 t_1 (fma (sin phi2) (cos phi1) (- t_2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2));
double t_1 = cos(phi2) * t_0;
double t_2 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2));
double tmp;
if (phi2 <= -5e-5) {
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - t_2));
} else if (phi2 <= 6e-5) {
tmp = atan2(t_0, fma(fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))), -sin(phi1), (phi2 * cos(phi1))));
} else {
tmp = atan2(t_1, fma(sin(phi2), cos(phi1), -t_2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) t_1 = Float64(cos(phi2) * t_0) t_2 = Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi2 <= -5e-5) tmp = atan(t_1, Float64(Float64(cos(phi1) * sin(phi2)) - t_2)); elseif (phi2 <= 6e-5) tmp = atan(t_0, fma(fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))), Float64(-sin(phi1)), Float64(phi2 * cos(phi1)))); else tmp = atan(t_1, fma(sin(phi2), cos(phi1), Float64(-t_2))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -5e-5], N[ArcTan[t$95$1 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 6e-5], N[ArcTan[t$95$0 / N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + (-t$95$2)), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\\
t_1 := \cos \phi_2 \cdot t\_0\\
t_2 := \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 \cdot \sin \phi_2 - t\_2}\\
\mathbf{elif}\;\phi_2 \leq 6 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right), -\sin \phi_1, \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, -t\_2\right)}\\
\end{array}
\end{array}
if phi2 < -5.00000000000000024e-5Initial program 78.2%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.2
Applied egg-rr89.2%
if -5.00000000000000024e-5 < phi2 < 6.00000000000000015e-5Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6483.1
Applied egg-rr83.1%
Taylor expanded in phi2 around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
Simplified83.1%
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift--.f6499.8
Applied egg-rr99.8%
if 6.00000000000000015e-5 < phi2 Initial program 86.9%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6494.6
Applied egg-rr94.6%
Applied egg-rr94.6%
Final simplification96.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(t_1
(atan2
(* (cos phi2) t_0)
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))))
(if (<= phi2 -8.2e-5)
t_1
(if (<= phi2 9.2e-5)
(atan2
t_0
(fma
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))
(- (sin phi1))
(* phi2 (cos phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2));
double t_1 = atan2((cos(phi2) * t_0), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
double tmp;
if (phi2 <= -8.2e-5) {
tmp = t_1;
} else if (phi2 <= 9.2e-5) {
tmp = atan2(t_0, fma(fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))), -sin(phi1), (phi2 * cos(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) t_1 = atan(Float64(cos(phi2) * t_0), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi2 <= -8.2e-5) tmp = t_1; elseif (phi2 <= 9.2e-5) tmp = atan(t_0, fma(fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))), Float64(-sin(phi1)), Float64(phi2 * cos(phi1)))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $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]}, If[LessEqual[phi2, -8.2e-5], t$95$1, If[LessEqual[phi2, 9.2e-5], N[ArcTan[t$95$0 / N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_2 \leq -8.2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 9.2 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right), -\sin \phi_1, \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -8.20000000000000009e-5 or 9.20000000000000001e-5 < phi2 Initial program 82.4%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6491.8
Applied egg-rr91.8%
if -8.20000000000000009e-5 < phi2 < 9.20000000000000001e-5Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6483.1
Applied egg-rr83.1%
Taylor expanded in phi2 around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
Simplified83.1%
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift--.f6499.8
Applied egg-rr99.8%
Final simplification96.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda2) (sin lambda1))))
(if (<= phi2 -6.6e-5)
(atan2
(* (cos phi2) (fma (sin (- lambda2)) (cos lambda1) t_0))
(-
(* (cos phi1) (sin phi2))
(* (cos lambda2) (* (cos phi2) (sin phi1)))))
(if (<= phi2 0.000102)
(atan2
(- t_0 (* (cos lambda1) (sin lambda2)))
(fma
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))
(- (sin phi1))
(* phi2 (cos phi1))))
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (- (* (sin phi1) (cos (- lambda1 lambda2)))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda2) * sin(lambda1);
double tmp;
if (phi2 <= -6.6e-5) {
tmp = atan2((cos(phi2) * fma(sin(-lambda2), cos(lambda1), t_0)), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * (cos(phi2) * sin(phi1)))));
} else if (phi2 <= 0.000102) {
tmp = atan2((t_0 - (cos(lambda1) * sin(lambda2))), fma(fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))), -sin(phi1), (phi2 * cos(phi1))));
} else {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(cos(phi1), sin(phi2), (cos(phi2) * -(sin(phi1) * cos((lambda1 - lambda2))))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda2) * sin(lambda1)) tmp = 0.0 if (phi2 <= -6.6e-5) tmp = atan(Float64(cos(phi2) * fma(sin(Float64(-lambda2)), cos(lambda1), t_0)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(lambda2) * Float64(cos(phi2) * sin(phi1))))); elseif (phi2 <= 0.000102) tmp = atan(Float64(t_0 - Float64(cos(lambda1) * sin(lambda2))), fma(fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))), Float64(-sin(phi1)), Float64(phi2 * cos(phi1)))); else tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(-Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -6.6e-5], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda2], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 0.000102], N[ArcTan[N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * (-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \sin \lambda_1\\
\mathbf{if}\;\phi_2 \leq -6.6 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \left(-\lambda_2\right), \cos \lambda_1, t\_0\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \lambda_2 \cdot \left(\cos \phi_2 \cdot \sin \phi_1\right)}\\
\mathbf{elif}\;\phi_2 \leq 0.000102:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0 - \cos \lambda_1 \cdot \sin \lambda_2}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right), -\sin \phi_1, \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(-\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\\
\end{array}
\end{array}
if phi2 < -6.6000000000000005e-5Initial program 78.2%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6474.6
Simplified74.6%
sub-negN/A
+-commutativeN/A
sin-sumN/A
lift-cos.f64N/A
cos-negN/A
lift-cos.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-neg.f6485.5
Applied egg-rr85.5%
if -6.6000000000000005e-5 < phi2 < 1.01999999999999999e-4Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6483.1
Applied egg-rr83.1%
Taylor expanded in phi2 around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
Simplified83.1%
sin-diffN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift--.f6499.8
Applied egg-rr99.8%
if 1.01999999999999999e-4 < phi2 Initial program 86.9%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f6486.9
Simplified86.9%
Final simplification93.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(fma (cos lambda1) (- t_0) t_1))))
(if (<= lambda1 -3.3e-5)
t_2
(if (<= lambda1 0.00034)
(atan2
(* (cos phi2) (- (* (cos lambda2) lambda1) (sin lambda2)))
(- t_1 (* t_0 (fma lambda1 (sin lambda2) (cos lambda2)))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos(phi1) * sin(phi2);
double t_2 = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), fma(cos(lambda1), -t_0, t_1));
double tmp;
if (lambda1 <= -3.3e-5) {
tmp = t_2;
} else if (lambda1 <= 0.00034) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * lambda1) - sin(lambda2))), (t_1 - (t_0 * fma(lambda1, sin(lambda2), cos(lambda2)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), fma(cos(lambda1), Float64(-t_0), t_1)) tmp = 0.0 if (lambda1 <= -3.3e-5) tmp = t_2; elseif (lambda1 <= 0.00034) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * lambda1) - sin(lambda2))), Float64(t_1 - Float64(t_0 * fma(lambda1, sin(lambda2), cos(lambda2))))); else tmp = t_2; end return 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[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[lambda1], $MachinePrecision] * (-t$95$0) + t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -3.3e-5], t$95$2, If[LessEqual[lambda1, 0.00034], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * lambda1), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$0 * N[(lambda1 * N[Sin[lambda2], $MachinePrecision] + N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_1, -t\_0, t\_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -3.3 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_1 \leq 0.00034:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \lambda_1 - \sin \lambda_2\right)}{t\_1 - t\_0 \cdot \mathsf{fma}\left(\lambda_1, \sin \lambda_2, \cos \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda1 < -3.3000000000000003e-5 or 3.4e-4 < lambda1 Initial program 63.0%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6478.5
Applied egg-rr78.5%
Taylor expanded in lambda2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6478.5
Simplified78.5%
if -3.3000000000000003e-5 < lambda1 < 3.4e-4Initial program 99.4%
Taylor expanded in lambda1 around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
sin-negN/A
remove-double-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f6499.5
Simplified99.5%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-negN/A
sin-negN/A
sub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Simplified99.8%
Final simplification90.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))
(t_1 (* (cos lambda2) (sin lambda1)))
(t_2
(atan2
(* (cos phi2) (- t_1 (sin lambda2)))
(- (* (cos phi1) (sin phi2)) t_0))))
(if (<= phi1 -3.35e+16)
t_2
(if (<= phi1 9.5e-61)
(atan2
(* (cos phi2) (- t_1 (* (cos lambda1) (sin lambda2))))
(- (sin phi2) t_0))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2));
double t_1 = cos(lambda2) * sin(lambda1);
double t_2 = atan2((cos(phi2) * (t_1 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_0));
double tmp;
if (phi1 <= -3.35e+16) {
tmp = t_2;
} else if (phi1 <= 9.5e-61) {
tmp = atan2((cos(phi2) * (t_1 - (cos(lambda1) * sin(lambda2)))), (sin(phi2) - t_0));
} else {
tmp = 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(phi2) * sin(phi1)) * cos((lambda1 - lambda2))
t_1 = cos(lambda2) * sin(lambda1)
t_2 = atan2((cos(phi2) * (t_1 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_0))
if (phi1 <= (-3.35d+16)) then
tmp = t_2
else if (phi1 <= 9.5d-61) then
tmp = atan2((cos(phi2) * (t_1 - (cos(lambda1) * sin(lambda2)))), (sin(phi2) - t_0))
else
tmp = 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(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2));
double t_1 = Math.cos(lambda2) * Math.sin(lambda1);
double t_2 = Math.atan2((Math.cos(phi2) * (t_1 - Math.sin(lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - t_0));
double tmp;
if (phi1 <= -3.35e+16) {
tmp = t_2;
} else if (phi1 <= 9.5e-61) {
tmp = Math.atan2((Math.cos(phi2) * (t_1 - (Math.cos(lambda1) * Math.sin(lambda2)))), (Math.sin(phi2) - t_0));
} else {
tmp = t_2;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = (math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)) t_1 = math.cos(lambda2) * math.sin(lambda1) t_2 = math.atan2((math.cos(phi2) * (t_1 - math.sin(lambda2))), ((math.cos(phi1) * math.sin(phi2)) - t_0)) tmp = 0 if phi1 <= -3.35e+16: tmp = t_2 elif phi1 <= 9.5e-61: tmp = math.atan2((math.cos(phi2) * (t_1 - (math.cos(lambda1) * math.sin(lambda2)))), (math.sin(phi2) - t_0)) else: tmp = t_2 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))) t_1 = Float64(cos(lambda2) * sin(lambda1)) t_2 = atan(Float64(cos(phi2) * Float64(t_1 - sin(lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - t_0)) tmp = 0.0 if (phi1 <= -3.35e+16) tmp = t_2; elseif (phi1 <= 9.5e-61) tmp = atan(Float64(cos(phi2) * Float64(t_1 - Float64(cos(lambda1) * sin(lambda2)))), Float64(sin(phi2) - t_0)); else tmp = t_2; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)); t_1 = cos(lambda2) * sin(lambda1); t_2 = atan2((cos(phi2) * (t_1 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - t_0)); tmp = 0.0; if (phi1 <= -3.35e+16) tmp = t_2; elseif (phi1 <= 9.5e-61) tmp = atan2((cos(phi2) * (t_1 - (cos(lambda1) * sin(lambda2)))), (sin(phi2) - t_0)); else tmp = t_2; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3.35e+16], t$95$2, If[LessEqual[phi1, 9.5e-61], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \lambda_2 \cdot \sin \lambda_1\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - t\_0}\\
\mathbf{if}\;\phi_1 \leq -3.35 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 9.5 \cdot 10^{-61}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -3.35e16 or 9.49999999999999986e-61 < phi1 Initial program 77.7%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6480.8
Applied egg-rr80.8%
Taylor expanded in lambda1 around 0
lower-sin.f6479.1
Simplified79.1%
if -3.35e16 < phi1 < 9.49999999999999986e-61Initial program 87.9%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.3
Applied egg-rr99.3%
Taylor expanded in phi1 around 0
lower-sin.f6499.3
Simplified99.3%
Final simplification88.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda2) (sin lambda1)))
(t_1
(atan2
(* (cos phi2) (- t_0 (sin lambda2)))
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -8.2e-48)
t_1
(if (<= phi1 7.5e-61)
(atan2
(* (cos phi2) (- t_0 (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda2) * sin(lambda1);
double t_1 = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -8.2e-48) {
tmp = t_1;
} else if (phi1 <= 7.5e-61) {
tmp = atan2((cos(phi2) * (t_0 - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(lambda2) * sin(lambda1)
t_1 = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
if (phi1 <= (-8.2d-48)) then
tmp = t_1
else if (phi1 <= 7.5d-61) then
tmp = atan2((cos(phi2) * (t_0 - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(lambda2) * Math.sin(lambda1);
double t_1 = Math.atan2((Math.cos(phi2) * (t_0 - Math.sin(lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -8.2e-48) {
tmp = t_1;
} else if (phi1 <= 7.5e-61) {
tmp = Math.atan2((Math.cos(phi2) * (t_0 - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(lambda2) * math.sin(lambda1) t_1 = math.atan2((math.cos(phi2) * (t_0 - math.sin(lambda2))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -8.2e-48: tmp = t_1 elif phi1 <= 7.5e-61: tmp = math.atan2((math.cos(phi2) * (t_0 - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda2) * sin(lambda1)) t_1 = atan(Float64(cos(phi2) * Float64(t_0 - sin(lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -8.2e-48) tmp = t_1; elseif (phi1 <= 7.5e-61) tmp = atan(Float64(cos(phi2) * Float64(t_0 - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(lambda2) * sin(lambda1); t_1 = atan2((cos(phi2) * (t_0 - sin(lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -8.2e-48) tmp = t_1; elseif (phi1 <= 7.5e-61) tmp = atan2((cos(phi2) * (t_0 - (cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -8.2e-48], t$95$1, If[LessEqual[phi1, 7.5e-61], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_2 \cdot \sin \lambda_1\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -8.2 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 7.5 \cdot 10^{-61}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -8.20000000000000028e-48 or 7.50000000000000047e-61 < phi1 Initial program 79.0%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6482.7
Applied egg-rr82.7%
Taylor expanded in lambda1 around 0
lower-sin.f6481.1
Simplified81.1%
if -8.20000000000000028e-48 < phi1 < 7.50000000000000047e-61Initial program 87.7%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in phi1 around 0
lower-sin.f6499.9
Simplified99.9%
Final simplification88.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (- (* (sin phi1) (cos (- lambda1 lambda2)))))))))
(if (<= phi1 -3.2e-12)
t_0
(if (<= phi1 3.5e-35)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(- (sin phi2) (* (cos phi2) (* (cos lambda1) phi1))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(cos(phi1), sin(phi2), (cos(phi2) * -(sin(phi1) * cos((lambda1 - lambda2))))));
double tmp;
if (phi1 <= -3.2e-12) {
tmp = t_0;
} else if (phi1 <= 3.5e-35) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), (sin(phi2) - (cos(phi2) * (cos(lambda1) * phi1))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(-Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))))) tmp = 0.0 if (phi1 <= -3.2e-12) tmp = t_0; elseif (phi1 <= 3.5e-35) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), Float64(sin(phi2) - Float64(cos(phi2) * Float64(cos(lambda1) * phi1)))); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * (-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3.2e-12], t$95$0, If[LessEqual[phi1, 3.5e-35], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(-\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\\
\mathbf{if}\;\phi_1 \leq -3.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 3.5 \cdot 10^{-35}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -3.2000000000000001e-12 or 3.49999999999999996e-35 < phi1 Initial program 78.0%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f6478.0
Simplified78.0%
if -3.2000000000000001e-12 < phi1 < 3.49999999999999996e-35Initial program 87.7%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in lambda2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Simplified99.9%
Taylor expanded in phi1 around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6499.9
Simplified99.9%
Final simplification88.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_3 (* (cos phi1) (sin phi2)))
(t_4
(atan2
(* (cos phi2) (sin (- lambda2)))
(- t_3 (* (cos lambda2) t_0)))))
(if (<= lambda2 -2.3e-5)
t_4
(if (<= lambda2 -9.2e-266)
(atan2 t_2 (fma (cos phi2) (- (sin phi1)) t_3))
(if (<= lambda2 3.9e-92)
(atan2 (* (cos phi2) (sin lambda1)) (- t_3 (* t_0 t_1)))
(if (<= lambda2 7.2e+47)
(atan2 t_2 (- t_3 (* (sin phi1) t_1)))
t_4))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos((lambda1 - lambda2));
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double t_3 = cos(phi1) * sin(phi2);
double t_4 = atan2((cos(phi2) * sin(-lambda2)), (t_3 - (cos(lambda2) * t_0)));
double tmp;
if (lambda2 <= -2.3e-5) {
tmp = t_4;
} else if (lambda2 <= -9.2e-266) {
tmp = atan2(t_2, fma(cos(phi2), -sin(phi1), t_3));
} else if (lambda2 <= 3.9e-92) {
tmp = atan2((cos(phi2) * sin(lambda1)), (t_3 - (t_0 * t_1)));
} else if (lambda2 <= 7.2e+47) {
tmp = atan2(t_2, (t_3 - (sin(phi1) * t_1)));
} else {
tmp = t_4;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_3 = Float64(cos(phi1) * sin(phi2)) t_4 = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(t_3 - Float64(cos(lambda2) * t_0))) tmp = 0.0 if (lambda2 <= -2.3e-5) tmp = t_4; elseif (lambda2 <= -9.2e-266) tmp = atan(t_2, fma(cos(phi2), Float64(-sin(phi1)), t_3)); elseif (lambda2 <= 3.9e-92) tmp = atan(Float64(cos(phi2) * sin(lambda1)), Float64(t_3 - Float64(t_0 * t_1))); elseif (lambda2 <= 7.2e+47) tmp = atan(t_2, Float64(t_3 - Float64(sin(phi1) * t_1))); else tmp = t_4; end return 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[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(t$95$3 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -2.3e-5], t$95$4, If[LessEqual[lambda2, -9.2e-266], N[ArcTan[t$95$2 / N[(N[Cos[phi2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 3.9e-92], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] / N[(t$95$3 - N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 7.2e+47], N[ArcTan[t$95$2 / N[(t$95$3 - N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$4]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_3 := \cos \phi_1 \cdot \sin \phi_2\\
t_4 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{t\_3 - \cos \lambda_2 \cdot t\_0}\\
\mathbf{if}\;\lambda_2 \leq -2.3 \cdot 10^{-5}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;\lambda_2 \leq -9.2 \cdot 10^{-266}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\cos \phi_2, -\sin \phi_1, t\_3\right)}\\
\mathbf{elif}\;\lambda_2 \leq 3.9 \cdot 10^{-92}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{t\_3 - t\_0 \cdot t\_1}\\
\mathbf{elif}\;\lambda_2 \leq 7.2 \cdot 10^{+47}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_3 - \sin \phi_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if lambda2 < -2.3e-5 or 7.20000000000000015e47 < lambda2 Initial program 65.5%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6465.5
Simplified65.5%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6466.2
Simplified66.2%
if -2.3e-5 < lambda2 < -9.19999999999999986e-266Initial program 99.8%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6493.7
Simplified93.7%
Taylor expanded in lambda2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6493.7
Simplified93.7%
if -9.19999999999999986e-266 < lambda2 < 3.8999999999999997e-92Initial program 99.8%
Taylor expanded in lambda2 around 0
lower-sin.f6495.8
Simplified95.8%
if 3.8999999999999997e-92 < lambda2 < 7.20000000000000015e47Initial program 85.4%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6480.1
Simplified80.1%
Final simplification80.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_2 (* (cos phi1) (sin phi2)))
(t_3
(atan2
(* (cos phi2) (sin (- lambda2)))
(- t_2 (* (cos lambda2) t_0)))))
(if (<= lambda2 -1.45e-5)
t_3
(if (<= lambda2 -2e-265)
(atan2 t_1 (fma (cos phi2) (- (sin phi1)) t_2))
(if (<= lambda2 1.5e-90)
(atan2 (* (cos phi2) (sin lambda1)) (fma (cos lambda1) (- t_0) t_2))
(if (<= lambda2 1.25e+48)
(atan2 t_1 (- t_2 (* (sin phi1) (cos (- lambda1 lambda2)))))
t_3))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double t_2 = cos(phi1) * sin(phi2);
double t_3 = atan2((cos(phi2) * sin(-lambda2)), (t_2 - (cos(lambda2) * t_0)));
double tmp;
if (lambda2 <= -1.45e-5) {
tmp = t_3;
} else if (lambda2 <= -2e-265) {
tmp = atan2(t_1, fma(cos(phi2), -sin(phi1), t_2));
} else if (lambda2 <= 1.5e-90) {
tmp = atan2((cos(phi2) * sin(lambda1)), fma(cos(lambda1), -t_0, t_2));
} else if (lambda2 <= 1.25e+48) {
tmp = atan2(t_1, (t_2 - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = t_3;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_2 = Float64(cos(phi1) * sin(phi2)) t_3 = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(t_2 - Float64(cos(lambda2) * t_0))) tmp = 0.0 if (lambda2 <= -1.45e-5) tmp = t_3; elseif (lambda2 <= -2e-265) tmp = atan(t_1, fma(cos(phi2), Float64(-sin(phi1)), t_2)); elseif (lambda2 <= 1.5e-90) tmp = atan(Float64(cos(phi2) * sin(lambda1)), fma(cos(lambda1), Float64(-t_0), t_2)); elseif (lambda2 <= 1.25e+48) tmp = atan(t_1, Float64(t_2 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_3; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -1.45e-5], t$95$3, If[LessEqual[lambda2, -2e-265], N[ArcTan[t$95$1 / N[(N[Cos[phi2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 1.5e-90], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[lambda1], $MachinePrecision] * (-t$95$0) + t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 1.25e+48], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_1 \cdot \sin \phi_2\\
t_3 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{t\_2 - \cos \lambda_2 \cdot t\_0}\\
\mathbf{if}\;\lambda_2 \leq -1.45 \cdot 10^{-5}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\lambda_2 \leq -2 \cdot 10^{-265}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\cos \phi_2, -\sin \phi_1, t\_2\right)}\\
\mathbf{elif}\;\lambda_2 \leq 1.5 \cdot 10^{-90}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{\mathsf{fma}\left(\cos \lambda_1, -t\_0, t\_2\right)}\\
\mathbf{elif}\;\lambda_2 \leq 1.25 \cdot 10^{+48}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if lambda2 < -1.45e-5 or 1.24999999999999993e48 < lambda2 Initial program 65.5%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6465.5
Simplified65.5%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6466.2
Simplified66.2%
if -1.45e-5 < lambda2 < -1.99999999999999997e-265Initial program 99.8%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6493.7
Simplified93.7%
Taylor expanded in lambda2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6493.7
Simplified93.7%
if -1.99999999999999997e-265 < lambda2 < 1.5000000000000001e-90Initial program 99.8%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in lambda2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Simplified99.8%
Taylor expanded in lambda2 around 0
lower-sin.f6495.8
Simplified95.8%
if 1.5000000000000001e-90 < lambda2 < 1.24999999999999993e48Initial program 85.4%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6480.1
Simplified80.1%
Final simplification80.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (- (* (sin phi1) (cos (- lambda1 lambda2)))))))))
(if (<= phi1 -6.5e-48)
t_0
(if (<= phi1 1.45e-36)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(cos(phi1), sin(phi2), (cos(phi2) * -(sin(phi1) * cos((lambda1 - lambda2))))));
double tmp;
if (phi1 <= -6.5e-48) {
tmp = t_0;
} else if (phi1 <= 1.45e-36) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(-Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))))) tmp = 0.0 if (phi1 <= -6.5e-48) tmp = t_0; elseif (phi1 <= 1.45e-36) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * (-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -6.5e-48], t$95$0, If[LessEqual[phi1, 1.45e-36], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(-\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\\
\mathbf{if}\;\phi_1 \leq -6.5 \cdot 10^{-48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 1.45 \cdot 10^{-36}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -6.5e-48 or 1.45000000000000006e-36 < phi1 Initial program 79.0%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f6479.0
Simplified79.0%
if -6.5e-48 < phi1 < 1.45000000000000006e-36Initial program 87.4%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in phi1 around 0
lower-sin.f6499.9
Simplified99.9%
Final simplification88.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (<= lambda1 -1050.0)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 0.072)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(fma t_1 (- (cos lambda2)) t_0))
(atan2
(* (cos phi2) (sin lambda1))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if (lambda1 <= -1050.0) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= 0.072) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(t_1, -cos(lambda2), t_0));
} else {
tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if (lambda1 <= -1050.0) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 0.072) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(t_1, Float64(-cos(lambda2)), t_0)); else tmp = atan(Float64(cos(phi2) * sin(lambda1)), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -1050.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.072], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * (-N[Cos[lambda2], $MachinePrecision]) + t$95$0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_1 \leq -1050:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq 0.072:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(t\_1, -\cos \lambda_2, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if lambda1 < -1050Initial program 60.4%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6482.8
Applied egg-rr82.8%
Taylor expanded in phi1 around 0
lower-sin.f6465.0
Simplified65.0%
if -1050 < lambda1 < 0.0719999999999999946Initial program 99.4%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6499.4
Simplified99.4%
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6499.4
Applied egg-rr99.4%
if 0.0719999999999999946 < lambda1 Initial program 64.2%
Taylor expanded in lambda2 around 0
lower-sin.f6466.2
Simplified66.2%
Final simplification84.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))))
(if (<= lambda1 -1050.0)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 0.016)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (cos phi2) (* (cos lambda2) (sin phi1)))))
(atan2
(* (cos phi2) (sin lambda1))
(- t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -1050.0) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= 0.016) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (cos(lambda2) * sin(phi1)))));
} else {
tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
if (lambda1 <= (-1050.0d0)) then
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else if (lambda1 <= 0.016d0) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (cos(lambda2) * sin(phi1)))))
else
tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -1050.0) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.cos(lambda2) * Math.sin(lambda1)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else if (lambda1 <= 0.016) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.cos(phi2) * (Math.cos(lambda2) * Math.sin(phi1)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(lambda1)), (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -1050.0: tmp = math.atan2((math.cos(phi2) * ((math.cos(lambda2) * math.sin(lambda1)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) elif lambda1 <= 0.016: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.cos(phi2) * (math.cos(lambda2) * math.sin(phi1))))) else: tmp = math.atan2((math.cos(phi2) * math.sin(lambda1)), (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -1050.0) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 0.016) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(cos(phi2) * Float64(cos(lambda2) * sin(phi1))))); else tmp = atan(Float64(cos(phi2) * sin(lambda1)), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -1050.0) tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 0.016) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (cos(phi2) * (cos(lambda2) * sin(phi1))))); else tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -1050.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.016], 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], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -1050:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq 0.016:\\
\;\;\;\;\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)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if lambda1 < -1050Initial program 60.4%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6482.8
Applied egg-rr82.8%
Taylor expanded in phi1 around 0
lower-sin.f6465.0
Simplified65.0%
if -1050 < lambda1 < 0.016Initial program 99.4%
Taylor expanded in lambda1 around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f6499.4
Simplified99.4%
if 0.016 < lambda1 Initial program 64.2%
Taylor expanded in lambda2 around 0
lower-sin.f6466.2
Simplified66.2%
Final simplification84.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -1.75e-48)
t_0
(if (<= phi1 4.6e-10)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -1.75e-48) {
tmp = t_0;
} else if (phi1 <= 4.6e-10) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = 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 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
if (phi1 <= (-1.75d-48)) then
tmp = t_0
else if (phi1 <= 4.6d-10) then
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -1.75e-48) {
tmp = t_0;
} else if (phi1 <= 4.6e-10) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.cos(lambda2) * Math.sin(lambda1)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -1.75e-48: tmp = t_0 elif phi1 <= 4.6e-10: tmp = math.atan2((math.cos(phi2) * ((math.cos(lambda2) * math.sin(lambda1)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -1.75e-48) tmp = t_0; elseif (phi1 <= 4.6e-10) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -1.75e-48) tmp = t_0; elseif (phi1 <= 4.6e-10) tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = 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]}, If[LessEqual[phi1, -1.75e-48], t$95$0, If[LessEqual[phi1, 4.6e-10], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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)}\\
\mathbf{if}\;\phi_1 \leq -1.75 \cdot 10^{-48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -1.74999999999999996e-48 or 4.60000000000000014e-10 < phi1 Initial program 78.6%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6458.6
Simplified58.6%
if -1.74999999999999996e-48 < phi1 < 4.60000000000000014e-10Initial program 87.7%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in phi1 around 0
lower-sin.f6499.6
Simplified99.6%
Final simplification76.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))))
(if (<= lambda1 -13000000.0)
t_0
(if (<= lambda1 0.31)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- (* (cos phi1) (sin phi2)) (* (cos lambda2) (sin phi1))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
double tmp;
if (lambda1 <= -13000000.0) {
tmp = t_0;
} else if (lambda1 <= 0.31) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * sin(phi1))));
} else {
tmp = 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 = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
if (lambda1 <= (-13000000.0d0)) then
tmp = t_0
else if (lambda1 <= 0.31d0) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * sin(phi1))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.cos(phi2) * ((Math.cos(lambda2) * Math.sin(lambda1)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
double tmp;
if (lambda1 <= -13000000.0) {
tmp = t_0;
} else if (lambda1 <= 0.31) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(lambda2) * Math.sin(phi1))));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.cos(phi2) * ((math.cos(lambda2) * math.sin(lambda1)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) tmp = 0 if lambda1 <= -13000000.0: tmp = t_0 elif lambda1 <= 0.31: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(lambda2) * math.sin(phi1)))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)) tmp = 0.0 if (lambda1 <= -13000000.0) tmp = t_0; elseif (lambda1 <= 0.31) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(lambda2) * sin(phi1)))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); tmp = 0.0; if (lambda1 <= -13000000.0) tmp = t_0; elseif (lambda1 <= 0.31) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(lambda2) * sin(phi1)))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -13000000.0], t$95$0, If[LessEqual[lambda1, 0.31], 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[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{if}\;\lambda_1 \leq -13000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 0.31:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \lambda_2 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -1.3e7 or 0.309999999999999998 < lambda1 Initial program 62.9%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6478.9
Applied egg-rr78.9%
Taylor expanded in phi1 around 0
lower-sin.f6465.1
Simplified65.1%
if -1.3e7 < lambda1 < 0.309999999999999998Initial program 98.2%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6497.7
Simplified97.7%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6482.5
Simplified82.5%
Final simplification74.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(sin (- lambda1 lambda2))
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -3.8e-44)
t_0
(if (<= phi1 1.4e-9)
(atan2
(*
(cos phi2)
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3.8e-44) {
tmp = t_0;
} else if (phi1 <= 1.4e-9) {
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = 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 = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
if (phi1 <= (-3.8d-44)) then
tmp = t_0
else if (phi1 <= 1.4d-9) then
tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3.8e-44) {
tmp = t_0;
} else if (phi1 <= 1.4e-9) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.cos(lambda2) * Math.sin(lambda1)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -3.8e-44: tmp = t_0 elif phi1 <= 1.4e-9: tmp = math.atan2((math.cos(phi2) * ((math.cos(lambda2) * math.sin(lambda1)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -3.8e-44) tmp = t_0; elseif (phi1 <= 1.4e-9) tmp = atan(Float64(cos(phi2) * Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -3.8e-44) tmp = t_0; elseif (phi1 <= 1.4e-9) tmp = atan2((cos(phi2) * ((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3.8e-44], t$95$0, If[LessEqual[phi1, 1.4e-9], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -3.8 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -3.8000000000000001e-44 or 1.39999999999999992e-9 < phi1 Initial program 78.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6453.6
Simplified53.6%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6453.6
Simplified53.6%
if -3.8000000000000001e-44 < phi1 < 1.39999999999999992e-9Initial program 87.9%
sin-diffN/A
lower--.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied egg-rr99.9%
Taylor expanded in phi1 around 0
lower-sin.f6498.8
Simplified98.8%
Final simplification74.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1
(atan2
t_0
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -6.8e-5)
t_1
(if (<= phi1 5.8e-9)
(atan2
(* (cos phi2) t_0)
(- (sin phi2) (* (cos phi2) (* (cos lambda2) phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -6.8e-5) {
tmp = t_1;
} else if (phi1 <= 5.8e-9) {
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
if (phi1 <= (-6.8d-5)) then
tmp = t_1
else if (phi1 <= 5.8d-9) then
tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2(t_0, ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -6.8e-5) {
tmp = t_1;
} else if (phi1 <= 5.8e-9) {
tmp = Math.atan2((Math.cos(phi2) * t_0), (Math.sin(phi2) - (Math.cos(phi2) * (Math.cos(lambda2) * phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2(t_0, ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -6.8e-5: tmp = t_1 elif phi1 <= 5.8e-9: tmp = math.atan2((math.cos(phi2) * t_0), (math.sin(phi2) - (math.cos(phi2) * (math.cos(lambda2) * phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(t_0, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -6.8e-5) tmp = t_1; elseif (phi1 <= 5.8e-9) tmp = atan(Float64(cos(phi2) * t_0), Float64(sin(phi2) - Float64(cos(phi2) * Float64(cos(lambda2) * phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -6.8e-5) tmp = t_1; elseif (phi1 <= 5.8e-9) tmp = atan2((cos(phi2) * t_0), (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -6.8e-5], t$95$1, If[LessEqual[phi1, 5.8e-9], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -6.8 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 5.8 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -6.7999999999999999e-5 or 5.79999999999999982e-9 < phi1 Initial program 77.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6451.4
Simplified51.4%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6451.4
Simplified51.4%
if -6.7999999999999999e-5 < phi1 < 5.79999999999999982e-9Initial program 88.1%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6488.1
Simplified88.1%
Taylor expanded in phi1 around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-sin.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6488.1
Simplified88.1%
Final simplification69.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1
(atan2
t_0
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -8e-44)
t_1
(if (<= phi1 3.4e-9) (atan2 (* (cos phi2) t_0) (sin phi2)) t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 3.4e-9) {
tmp = atan2((cos(phi2) * t_0), sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
if (phi1 <= (-8d-44)) then
tmp = t_1
else if (phi1 <= 3.4d-9) then
tmp = atan2((cos(phi2) * t_0), sin(phi2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2(t_0, ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 3.4e-9) {
tmp = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2(t_0, ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -8e-44: tmp = t_1 elif phi1 <= 3.4e-9: tmp = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(t_0, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 3.4e-9) tmp = atan(Float64(cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 3.4e-9) tmp = atan2((cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -8e-44], t$95$1, If[LessEqual[phi1, 3.4e-9], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -7.99999999999999962e-44 or 3.3999999999999998e-9 < phi1 Initial program 78.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6453.6
Simplified53.6%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6453.6
Simplified53.6%
if -7.99999999999999962e-44 < phi1 < 3.3999999999999998e-9Initial program 87.9%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6487.9
Simplified87.9%
Taylor expanded in phi1 around 0
lower-sin.f6486.9
Simplified86.9%
Final simplification68.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -3.2e-5)
t_1
(if (<= phi2 0.000118)
(atan2
t_0
(- (sin phi2) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -3.2e-5) {
tmp = t_1;
} else if (phi2 <= 0.000118) {
tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-3.2d-5)) then
tmp = t_1
else if (phi2 <= 0.000118d0) then
tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -3.2e-5) {
tmp = t_1;
} else if (phi2 <= 0.000118) {
tmp = Math.atan2(t_0, (Math.sin(phi2) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -3.2e-5: tmp = t_1 elif phi2 <= 0.000118: tmp = math.atan2(t_0, (math.sin(phi2) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -3.2e-5) tmp = t_1; elseif (phi2 <= 0.000118) tmp = atan(t_0, Float64(sin(phi2) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -3.2e-5) tmp = t_1; elseif (phi2 <= 0.000118) tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -3.2e-5], t$95$1, If[LessEqual[phi2, 0.000118], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.000118:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -3.19999999999999986e-5 or 1.18e-4 < phi2 Initial program 82.4%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6476.7
Simplified76.7%
Taylor expanded in phi1 around 0
lower-sin.f6453.2
Simplified53.2%
if -3.19999999999999986e-5 < phi2 < 1.18e-4Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
Taylor expanded in phi1 around 0
lower-sin.f6482.9
Simplified82.9%
Final simplification68.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -0.034)
t_1
(if (<= phi2 0.00026)
(atan2
t_0
(- (* phi2 (cos phi1)) (* (sin phi1) (cos (- lambda1 lambda2)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -0.034) {
tmp = t_1;
} else if (phi2 <= 0.00026) {
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-0.034d0)) then
tmp = t_1
else if (phi2 <= 0.00026d0) then
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -0.034) {
tmp = t_1;
} else if (phi2 <= 0.00026) {
tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -0.034: tmp = t_1 elif phi2 <= 0.00026: tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -0.034) tmp = t_1; elseif (phi2 <= 0.00026) tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -0.034) tmp = t_1; elseif (phi2 <= 0.00026) tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.034], t$95$1, If[LessEqual[phi2, 0.00026], 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], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.034:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.00026:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -0.034000000000000002 or 2.59999999999999977e-4 < phi2 Initial program 82.4%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6476.7
Simplified76.7%
Taylor expanded in phi1 around 0
lower-sin.f6453.2
Simplified53.2%
if -0.034000000000000002 < phi2 < 2.59999999999999977e-4Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
Taylor expanded in phi2 around 0
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f6482.9
Simplified82.9%
Final simplification68.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 t_0 (- (* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -8e-44)
t_1
(if (<= phi1 7e-10) (atan2 (* (cos phi2) t_0) (sin phi2)) t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2(t_0, -(sin(phi1) * cos((lambda1 - lambda2))));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 7e-10) {
tmp = atan2((cos(phi2) * t_0), sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2(t_0, -(sin(phi1) * cos((lambda1 - lambda2))))
if (phi1 <= (-8d-44)) then
tmp = t_1
else if (phi1 <= 7d-10) then
tmp = atan2((cos(phi2) * t_0), sin(phi2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2(t_0, -(Math.sin(phi1) * Math.cos((lambda1 - lambda2))));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 7e-10) {
tmp = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2(t_0, -(math.sin(phi1) * math.cos((lambda1 - lambda2)))) tmp = 0 if phi1 <= -8e-44: tmp = t_1 elif phi1 <= 7e-10: tmp = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(t_0, Float64(-Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 7e-10) tmp = atan(Float64(cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2(t_0, -(sin(phi1) * cos((lambda1 - lambda2)))); tmp = 0.0; if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 7e-10) tmp = atan2((cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / (-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -8e-44], t$95$1, If[LessEqual[phi1, 7e-10], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0}{-\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -7.99999999999999962e-44 or 6.99999999999999961e-10 < phi1 Initial program 78.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6453.6
Simplified53.6%
Taylor expanded in phi2 around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f6451.0
Simplified51.0%
if -7.99999999999999962e-44 < phi1 < 6.99999999999999961e-10Initial program 87.9%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6487.9
Simplified87.9%
Taylor expanded in phi1 around 0
lower-sin.f6486.9
Simplified86.9%
Final simplification67.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -8e-5)
t_1
(if (<= phi2 0.0027)
(atan2 t_0 (fma (cos lambda2) (- (sin phi1)) phi2))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -8e-5) {
tmp = t_1;
} else if (phi2 <= 0.0027) {
tmp = atan2(t_0, fma(cos(lambda2), -sin(phi1), phi2));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -8e-5) tmp = t_1; elseif (phi2 <= 0.0027) tmp = atan(t_0, fma(cos(lambda2), Float64(-sin(phi1)), phi2)); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -8e-5], t$95$1, If[LessEqual[phi2, 0.0027], N[ArcTan[t$95$0 / N[(N[Cos[lambda2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + phi2), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -8 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.0027:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\cos \lambda_2, -\sin \phi_1, \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -8.00000000000000065e-5 or 0.0027000000000000001 < phi2 Initial program 82.4%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6476.7
Simplified76.7%
Taylor expanded in phi1 around 0
lower-sin.f6453.2
Simplified53.2%
if -8.00000000000000065e-5 < phi2 < 0.0027000000000000001Initial program 82.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.9
Simplified82.9%
Taylor expanded in lambda1 around 0
sub-negN/A
cos-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6476.5
Simplified76.5%
Taylor expanded in phi1 around 0
lower-sin.f6476.5
Simplified76.5%
Taylor expanded in phi2 around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6476.5
Simplified76.5%
Final simplification65.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 t_0 (* (sin phi1) (- (cos lambda2))))))
(if (<= phi1 -8e-44)
t_1
(if (<= phi1 3.4e-9) (atan2 (* (cos phi2) t_0) (sin phi2)) t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2(t_0, (sin(phi1) * -cos(lambda2)));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 3.4e-9) {
tmp = atan2((cos(phi2) * t_0), sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2(t_0, (sin(phi1) * -cos(lambda2)))
if (phi1 <= (-8d-44)) then
tmp = t_1
else if (phi1 <= 3.4d-9) then
tmp = atan2((cos(phi2) * t_0), sin(phi2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2(t_0, (Math.sin(phi1) * -Math.cos(lambda2)));
double tmp;
if (phi1 <= -8e-44) {
tmp = t_1;
} else if (phi1 <= 3.4e-9) {
tmp = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2(t_0, (math.sin(phi1) * -math.cos(lambda2))) tmp = 0 if phi1 <= -8e-44: tmp = t_1 elif phi1 <= 3.4e-9: tmp = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(t_0, Float64(sin(phi1) * Float64(-cos(lambda2)))) tmp = 0.0 if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 3.4e-9) tmp = atan(Float64(cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2(t_0, (sin(phi1) * -cos(lambda2))); tmp = 0.0; if (phi1 <= -8e-44) tmp = t_1; elseif (phi1 <= 3.4e-9) tmp = atan2((cos(phi2) * t_0), sin(phi2)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[(N[Sin[phi1], $MachinePrecision] * (-N[Cos[lambda2], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -8e-44], t$95$1, If[LessEqual[phi1, 3.4e-9], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0}{\sin \phi_1 \cdot \left(-\cos \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -7.99999999999999962e-44 or 3.3999999999999998e-9 < phi1 Initial program 78.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6453.6
Simplified53.6%
Taylor expanded in lambda1 around 0
sub-negN/A
cos-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6447.4
Simplified47.4%
Taylor expanded in phi2 around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-cos.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f6444.9
Simplified44.9%
if -7.99999999999999962e-44 < phi1 < 3.3999999999999998e-9Initial program 87.9%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6487.9
Simplified87.9%
Taylor expanded in phi1 around 0
lower-sin.f6486.9
Simplified86.9%
Final simplification63.9%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * 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((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
\end{array}
Initial program 82.6%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6476.6
Simplified76.6%
Taylor expanded in phi1 around 0
lower-sin.f6453.1
Simplified53.1%
Final simplification53.1%
(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 82.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6452.8
Simplified52.8%
Taylor expanded in phi1 around 0
lower-sin.f6434.9
Simplified34.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 1.2e-46)
(atan2
(sin (- lambda1 lambda2))
(fma
phi2
(*
(* phi2 phi2)
(fma (* phi2 phi2) 0.008333333333333333 -0.16666666666666666))
phi2))
(atan2
(sin (- lambda2))
(fma phi2 (* (* phi2 phi2) -0.16666666666666666) phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.2e-46) {
tmp = atan2(sin((lambda1 - lambda2)), fma(phi2, ((phi2 * phi2) * fma((phi2 * phi2), 0.008333333333333333, -0.16666666666666666)), phi2));
} else {
tmp = atan2(sin(-lambda2), fma(phi2, ((phi2 * phi2) * -0.16666666666666666), phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.2e-46) tmp = atan(sin(Float64(lambda1 - lambda2)), fma(phi2, Float64(Float64(phi2 * phi2) * fma(Float64(phi2 * phi2), 0.008333333333333333, -0.16666666666666666)), phi2)); else tmp = atan(sin(Float64(-lambda2)), fma(phi2, Float64(Float64(phi2 * phi2) * -0.16666666666666666), phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.2e-46], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * N[(N[(phi2 * phi2), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[(-lambda2)], $MachinePrecision] / N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.2 \cdot 10^{-46}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot \mathsf{fma}\left(\phi_2 \cdot \phi_2, 0.008333333333333333, -0.16666666666666666\right), \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right)}{\mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666, \phi_2\right)}\\
\end{array}
\end{array}
if phi2 < 1.20000000000000007e-46Initial program 83.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6463.7
Simplified63.7%
Taylor expanded in phi1 around 0
lower-sin.f6441.6
Simplified41.6%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.9
Simplified41.9%
if 1.20000000000000007e-46 < phi2 Initial program 81.1%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6423.7
Simplified23.7%
Taylor expanded in phi1 around 0
lower-sin.f6417.2
Simplified17.2%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.4
Simplified19.4%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6420.9
Simplified20.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (fma phi2 (* (* phi2 phi2) -0.16666666666666666) phi2)))
(if (<= lambda1 -1.8e-127)
(atan2 (sin lambda1) t_0)
(if (<= lambda1 1.76e-149)
(atan2 (sin (- lambda2)) t_0)
(atan2
(sin (- lambda1 lambda2))
(* -0.16666666666666666 (* phi2 (* phi2 phi2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = fma(phi2, ((phi2 * phi2) * -0.16666666666666666), phi2);
double tmp;
if (lambda1 <= -1.8e-127) {
tmp = atan2(sin(lambda1), t_0);
} else if (lambda1 <= 1.76e-149) {
tmp = atan2(sin(-lambda2), t_0);
} else {
tmp = atan2(sin((lambda1 - lambda2)), (-0.16666666666666666 * (phi2 * (phi2 * phi2))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = fma(phi2, Float64(Float64(phi2 * phi2) * -0.16666666666666666), phi2) tmp = 0.0 if (lambda1 <= -1.8e-127) tmp = atan(sin(lambda1), t_0); elseif (lambda1 <= 1.76e-149) tmp = atan(sin(Float64(-lambda2)), t_0); else tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(-0.16666666666666666 * Float64(phi2 * Float64(phi2 * phi2)))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + phi2), $MachinePrecision]}, If[LessEqual[lambda1, -1.8e-127], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / t$95$0], $MachinePrecision], If[LessEqual[lambda1, 1.76e-149], N[ArcTan[N[Sin[(-lambda2)], $MachinePrecision] / t$95$0], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(-0.16666666666666666 * N[(phi2 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666, \phi_2\right)\\
\mathbf{if}\;\lambda_1 \leq -1.8 \cdot 10^{-127}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{t\_0}\\
\mathbf{elif}\;\lambda_1 \leq 1.76 \cdot 10^{-149}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{-0.16666666666666666 \cdot \left(\phi_2 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\end{array}
\end{array}
if lambda1 < -1.8e-127Initial program 75.0%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6446.3
Simplified46.3%
Taylor expanded in phi1 around 0
lower-sin.f6427.4
Simplified27.4%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6423.4
Simplified23.4%
Taylor expanded in lambda2 around 0
lower-sin.f6426.2
Simplified26.2%
if -1.8e-127 < lambda1 < 1.7599999999999999e-149Initial program 99.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6466.5
Simplified66.5%
Taylor expanded in phi1 around 0
lower-sin.f6443.7
Simplified43.7%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6441.2
Simplified41.2%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6439.7
Simplified39.7%
if 1.7599999999999999e-149 < lambda1 Initial program 76.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6448.1
Simplified48.1%
Taylor expanded in phi1 around 0
lower-sin.f6435.1
Simplified35.1%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6433.1
Simplified33.1%
Taylor expanded in phi2 around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.7
Simplified32.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (fma phi2 (* (* phi2 phi2) -0.16666666666666666) phi2))
(t_1 (atan2 (sin lambda1) t_0)))
(if (<= lambda1 -6e-127)
t_1
(if (<= lambda1 1.1e-116) (atan2 (sin (- lambda2)) t_0) t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = fma(phi2, ((phi2 * phi2) * -0.16666666666666666), phi2);
double t_1 = atan2(sin(lambda1), t_0);
double tmp;
if (lambda1 <= -6e-127) {
tmp = t_1;
} else if (lambda1 <= 1.1e-116) {
tmp = atan2(sin(-lambda2), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = fma(phi2, Float64(Float64(phi2 * phi2) * -0.16666666666666666), phi2) t_1 = atan(sin(lambda1), t_0) tmp = 0.0 if (lambda1 <= -6e-127) tmp = t_1; elseif (lambda1 <= 1.1e-116) tmp = atan(sin(Float64(-lambda2)), t_0); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + phi2), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[Sin[lambda1], $MachinePrecision] / t$95$0], $MachinePrecision]}, If[LessEqual[lambda1, -6e-127], t$95$1, If[LessEqual[lambda1, 1.1e-116], N[ArcTan[N[Sin[(-lambda2)], $MachinePrecision] / t$95$0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666, \phi_2\right)\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1}{t\_0}\\
\mathbf{if}\;\lambda_1 \leq -6 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 1.1 \cdot 10^{-116}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -6.00000000000000017e-127 or 1.10000000000000005e-116 < lambda1 Initial program 74.4%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6446.8
Simplified46.8%
Taylor expanded in phi1 around 0
lower-sin.f6431.2
Simplified31.2%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.9
Simplified27.9%
Taylor expanded in lambda2 around 0
lower-sin.f6428.7
Simplified28.7%
if -6.00000000000000017e-127 < lambda1 < 1.10000000000000005e-116Initial program 99.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6465.2
Simplified65.2%
Taylor expanded in phi1 around 0
lower-sin.f6442.7
Simplified42.7%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.8
Simplified40.8%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6439.4
Simplified39.4%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (fma phi2 (* (* phi2 phi2) -0.16666666666666666) phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), fma(phi2, ((phi2 * phi2) * -0.16666666666666666), phi2));
}
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), fma(phi2, Float64(Float64(phi2 * phi2) * -0.16666666666666666), phi2)) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666, \phi_2\right)}
\end{array}
Initial program 82.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6452.8
Simplified52.8%
Taylor expanded in phi1 around 0
lower-sin.f6434.9
Simplified34.9%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.1
Simplified32.1%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin lambda1) (fma phi2 (* (* phi2 phi2) -0.16666666666666666) phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin(lambda1), fma(phi2, ((phi2 * phi2) * -0.16666666666666666), phi2));
}
function code(lambda1, lambda2, phi1, phi2) return atan(sin(lambda1), fma(phi2, Float64(Float64(phi2 * phi2) * -0.16666666666666666), phi2)) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(phi2 * N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \lambda_1}{\mathsf{fma}\left(\phi_2, \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666, \phi_2\right)}
\end{array}
Initial program 82.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6452.8
Simplified52.8%
Taylor expanded in phi1 around 0
lower-sin.f6434.9
Simplified34.9%
Taylor expanded in phi2 around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.1
Simplified32.1%
Taylor expanded in lambda2 around 0
lower-sin.f6424.0
Simplified24.0%
herbie shell --seed 2024207
(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))))))