
(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 39 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 (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2))))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(fma
(* (sin lambda2) (* (cos phi2) (sin phi1)))
(sin lambda1)
(* (cos lambda2) (* (cos phi2) (* (cos lambda1) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - fma((sin(lambda2) * (cos(phi2) * sin(phi1))), sin(lambda1), (cos(lambda2) * (cos(phi2) * (cos(lambda1) * sin(phi1)))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2)))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - fma(Float64(sin(lambda2) * Float64(cos(phi2) * sin(phi1))), sin(lambda1), Float64(cos(lambda2) * Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1))))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[lambda2], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \mathsf{fma}\left(\sin \lambda_2 \cdot \left(\cos \phi_2 \cdot \sin \phi_1\right), \sin \lambda_1, \cos \lambda_2 \cdot \left(\cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)\right)\right)}
\end{array}
Initial program 80.5%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.7
Applied egg-rr89.7%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied egg-rr99.8%
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
distribute-lft-inN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1))))
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(-
(* (cos phi1) (sin phi2))
(fma
t_0
(* (cos lambda2) (cos lambda1))
(* (* (sin lambda1) (sin lambda2)) t_0))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), ((cos(phi1) * sin(phi2)) - fma(t_0, (cos(lambda2) * cos(lambda1)), ((sin(lambda1) * sin(lambda2)) * t_0))));
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), Float64(Float64(cos(phi1) * sin(phi2)) - fma(t_0, Float64(cos(lambda2) * cos(lambda1)), Float64(Float64(sin(lambda1) * sin(lambda2)) * t_0)))) end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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[(t$95$0 * N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \mathsf{fma}\left(t\_0, \cos \lambda_2 \cdot \cos \lambda_1, \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 80.5%
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.7
Applied egg-rr89.7%
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
cos-diffN/A
distribute-lft-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-*.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (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) * ((sin(lambda1) * cos(lambda2)) - (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(sin(lambda1) * cos(lambda2)) - 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[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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(\sin \lambda_1 \cdot \cos \lambda_2 - \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 80.5%
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.7
Applied egg-rr89.7%
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(fma
(cos phi2)
(*
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))
(- (sin phi1)))
(* (cos phi1) (sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), fma(cos(phi2), (fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))) * -sin(phi1)), (cos(phi1) * sin(phi2))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), fma(cos(phi2), Float64(fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2))) * Float64(-sin(phi1))), Float64(cos(phi1) * sin(phi2)))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi2], $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])), $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_2, \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(-\sin \phi_1\right), \cos \phi_1 \cdot \sin \phi_2\right)}
\end{array}
Initial program 80.5%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.7
Applied egg-rr89.7%
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.8
Applied egg-rr99.8%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
Simplified99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (cos (- lambda1 lambda2))))
(if (<= phi2 -1.85e-6)
(atan2 t_1 (- t_0 (* t_2 t_3)))
(if (<= phi2 1.42e+53)
(atan2
t_1
(-
t_0
(*
(sin phi1)
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2 t_1 (fma t_2 (- t_3) t_0))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)));
double t_2 = cos(phi2) * sin(phi1);
double t_3 = cos((lambda1 - lambda2));
double tmp;
if (phi2 <= -1.85e-6) {
tmp = atan2(t_1, (t_0 - (t_2 * t_3)));
} else if (phi2 <= 1.42e+53) {
tmp = atan2(t_1, (t_0 - (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2(t_1, fma(t_2, -t_3, t_0));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = cos(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= -1.85e-6) tmp = atan(t_1, Float64(t_0 - Float64(t_2 * t_3))); elseif (phi2 <= 1.42e+53) tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(t_1, fma(t_2, Float64(-t_3), t_0)); 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[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.85e-6], N[ArcTan[t$95$1 / N[(t$95$0 - N[(t$95$2 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 1.42e+53], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 * (-t$95$3) + t$95$0), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - t\_2 \cdot t\_3}\\
\mathbf{elif}\;\phi_2 \leq 1.42 \cdot 10^{+53}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(t\_2, -t\_3, t\_0\right)}\\
\end{array}
\end{array}
if phi2 < -1.8500000000000001e-6Initial program 80.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.f6489.0
Applied egg-rr89.0%
if -1.8500000000000001e-6 < phi2 < 1.41999999999999999e53Initial program 83.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.f6490.7
Applied egg-rr90.7%
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
cos-diffN/A
distribute-lft-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-*.f6499.9
Applied egg-rr99.9%
Taylor expanded in phi2 around 0
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f6498.8
Simplified98.8%
if 1.41999999999999999e53 < phi2 Initial program 69.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.f6488.0
Applied egg-rr88.0%
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.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
Applied egg-rr88.1%
Final simplification94.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2))) (t_1 (* (cos phi2) (sin phi1))))
(if (<= lambda2 -3100.0)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (* (cos lambda2) (- (sin phi1))))))
(if (<= lambda2 5e-23)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(+ t_0 (/ (cos (- lambda1 lambda2)) (/ -1.0 t_1))))
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2))))
(cos phi2))
(- t_0 (* (cos lambda2) t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double tmp;
if (lambda2 <= -3100.0) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), (cos(phi2) * (cos(lambda2) * -sin(phi1)))));
} else if (lambda2 <= 5e-23) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 + (cos((lambda1 - lambda2)) / (-1.0 / t_1))));
} else {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2))) * cos(phi2)), (t_0 - (cos(lambda2) * t_1)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if (lambda2 <= -3100.0) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(cos(lambda2) * Float64(-sin(phi1)))))); elseif (lambda2 <= 5e-23) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 + Float64(cos(Float64(lambda1 - lambda2)) / Float64(-1.0 / t_1)))); else tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2)))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda2) * t_1))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -3100.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 5e-23], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_2 \leq -3100:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \left(-\sin \phi_1\right)\right)\right)}\\
\mathbf{elif}\;\lambda_2 \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 + \frac{\cos \left(\lambda_1 - \lambda_2\right)}{\frac{-1}{t\_1}}}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_2 \cdot t\_1}\\
\end{array}
\end{array}
if lambda2 < -3100Initial program 55.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.f6474.0
Applied egg-rr74.0%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6473.8
Simplified73.8%
if -3100 < lambda2 < 5.0000000000000002e-23Initial program 99.8%
sin-cos-multN/A
lift--.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied egg-rr99.8%
if 5.0000000000000002e-23 < lambda2 Initial program 58.4%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6480.7
Applied egg-rr80.7%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6480.9
Simplified80.9%
Final simplification89.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (* (cos lambda2) (- (sin phi1))))))))
(if (<= lambda2 -3100.0)
t_0
(if (<= lambda2 5e-23)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(+
(* (cos phi1) (sin phi2))
(/ (cos (- lambda1 lambda2)) (/ -1.0 (* (cos phi2) (sin phi1))))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), (cos(phi2) * (cos(lambda2) * -sin(phi1)))));
double tmp;
if (lambda2 <= -3100.0) {
tmp = t_0;
} else if (lambda2 <= 5e-23) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) + (cos((lambda1 - lambda2)) / (-1.0 / (cos(phi2) * sin(phi1))))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(cos(lambda2) * Float64(-sin(phi1)))))) tmp = 0.0 if (lambda2 <= -3100.0) tmp = t_0; elseif (lambda2 <= 5e-23) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) + Float64(cos(Float64(lambda1 - lambda2)) / Float64(-1.0 / Float64(cos(phi2) * sin(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[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -3100.0], t$95$0, If[LessEqual[lambda2, 5e-23], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(-1.0 / N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \left(-\sin \phi_1\right)\right)\right)}\\
\mathbf{if}\;\lambda_2 \leq -3100:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_2 \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 + \frac{\cos \left(\lambda_1 - \lambda_2\right)}{\frac{-1}{\cos \phi_2 \cdot \sin \phi_1}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda2 < -3100 or 5.0000000000000002e-23 < lambda2 Initial program 57.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.f6477.6
Applied egg-rr77.6%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6477.6
Simplified77.6%
if -3100 < lambda2 < 5.0000000000000002e-23Initial program 99.8%
sin-cos-multN/A
lift--.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied egg-rr99.8%
Final simplification89.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(- t_0 (* (cos lambda1) t_1)))))
(if (<= lambda1 -0.32)
t_2
(if (<= lambda1 3.4e-16)
(atan2
(*
(cos phi2)
(-
(* lambda1 (fma -0.16666666666666666 (* lambda1 lambda1) 1.0))
(sin lambda2)))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), (t_0 - (cos(lambda1) * t_1)));
double tmp;
if (lambda1 <= -0.32) {
tmp = t_2;
} else if (lambda1 <= 3.4e-16) {
tmp = atan2((cos(phi2) * ((lambda1 * fma(-0.16666666666666666, (lambda1 * lambda1), 1.0)) - sin(lambda2))), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), Float64(t_0 - Float64(cos(lambda1) * t_1))) tmp = 0.0 if (lambda1 <= -0.32) tmp = t_2; elseif (lambda1 <= 3.4e-16) tmp = atan(Float64(cos(phi2) * Float64(Float64(lambda1 * fma(-0.16666666666666666, Float64(lambda1 * lambda1), 1.0)) - sin(lambda2))), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -0.32], t$95$2, If[LessEqual[lambda1, 3.4e-16], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(lambda1 * N[(-0.16666666666666666 * N[(lambda1 * lambda1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{t\_0 - \cos \lambda_1 \cdot t\_1}\\
\mathbf{if}\;\lambda_1 \leq -0.32:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_1 \leq 3.4 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \mathsf{fma}\left(-0.16666666666666666, \lambda_1 \cdot \lambda_1, 1\right) - \sin \lambda_2\right)}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda1 < -0.320000000000000007 or 3.4e-16 < lambda1 Initial 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.f6479.9
Applied egg-rr79.9%
Taylor expanded in lambda2 around 0
lower-cos.f6479.8
Simplified79.8%
if -0.320000000000000007 < lambda1 < 3.4e-16Initial program 98.5%
Taylor expanded in lambda1 around 0
+-commutativeN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
Simplified98.6%
Taylor expanded in lambda2 around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Simplified98.6%
Final simplification89.7%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))) (fma (* (cos phi2) (sin phi1)) (- (cos (- lambda1 lambda2))) (* (cos phi1) (sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), fma((cos(phi2) * sin(phi1)), -cos((lambda1 - lambda2)), (cos(phi1) * sin(phi2))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), fma(Float64(cos(phi2) * sin(phi1)), Float64(-cos(Float64(lambda1 - lambda2))), Float64(cos(phi1) * sin(phi2)))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * (-N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]) + N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_2 \cdot \sin \phi_1, -\cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}
\end{array}
Initial program 80.5%
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.7
Applied egg-rr89.7%
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.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
Applied egg-rr89.8%
Final simplification89.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \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 \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 80.5%
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.7
Applied egg-rr89.7%
Final simplification89.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))
(t_1 (- (* (cos phi1) (sin phi2)) t_0))
(t_2 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -0.105)
(atan2 (* (cos phi2) (- (sin lambda1) t_2)) t_1)
(if (<= phi1 9500000000.0)
(atan2
(* (cos phi2) (- (* (sin lambda1) (cos lambda2)) t_2))
(- (sin phi2) t_0))
(atan2 (/ 1.0 (/ 1.0 (* (cos phi2) (sin (- lambda1 lambda2))))) t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2));
double t_1 = (cos(phi1) * sin(phi2)) - t_0;
double t_2 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -0.105) {
tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), t_1);
} else if (phi1 <= 9500000000.0) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (sin(phi2) - t_0));
} else {
tmp = atan2((1.0 / (1.0 / (cos(phi2) * sin((lambda1 - lambda2))))), t_1);
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))
t_1 = (cos(phi1) * sin(phi2)) - t_0
t_2 = cos(lambda1) * sin(lambda2)
if (phi1 <= (-0.105d0)) then
tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), t_1)
else if (phi1 <= 9500000000.0d0) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (sin(phi2) - t_0))
else
tmp = atan2((1.0d0 / (1.0d0 / (cos(phi2) * sin((lambda1 - lambda2))))), t_1)
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (Math.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2));
double t_1 = (Math.cos(phi1) * Math.sin(phi2)) - t_0;
double t_2 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if (phi1 <= -0.105) {
tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_2)), t_1);
} else if (phi1 <= 9500000000.0) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - t_2)), (Math.sin(phi2) - t_0));
} else {
tmp = Math.atan2((1.0 / (1.0 / (Math.cos(phi2) * Math.sin((lambda1 - lambda2))))), t_1);
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = (math.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2)) t_1 = (math.cos(phi1) * math.sin(phi2)) - t_0 t_2 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if phi1 <= -0.105: tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_2)), t_1) elif phi1 <= 9500000000.0: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - t_2)), (math.sin(phi2) - t_0)) else: tmp = math.atan2((1.0 / (1.0 / (math.cos(phi2) * math.sin((lambda1 - lambda2))))), t_1) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))) t_1 = Float64(Float64(cos(phi1) * sin(phi2)) - t_0) t_2 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -0.105) tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_2)), t_1); elseif (phi1 <= 9500000000.0) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - t_2)), Float64(sin(phi2) - t_0)); else tmp = atan(Float64(1.0 / Float64(1.0 / Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))))), t_1); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = (cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)); t_1 = (cos(phi1) * sin(phi2)) - t_0; t_2 = cos(lambda1) * sin(lambda2); tmp = 0.0; if (phi1 <= -0.105) tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), t_1); elseif (phi1 <= 9500000000.0) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (sin(phi2) - t_0)); else tmp = atan2((1.0 / (1.0 / (cos(phi2) * sin((lambda1 - lambda2))))), t_1); 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[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -0.105], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision], If[LessEqual[phi1, 9500000000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(1.0 / N[(1.0 / N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]]]]]]
\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 \phi_1 \cdot \sin \phi_2 - t\_0\\
t_2 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -0.105:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_2\right)}{t\_1}\\
\mathbf{elif}\;\phi_1 \leq 9500000000:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_2\right)}{\sin \phi_2 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\frac{1}{\frac{1}{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}}}{t\_1}\\
\end{array}
\end{array}
if phi1 < -0.104999999999999996Initial program 71.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.f6475.1
Applied egg-rr75.1%
Taylor expanded in lambda2 around 0
lower-sin.f6472.2
Simplified72.2%
if -0.104999999999999996 < phi1 < 9.5e9Initial program 82.6%
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.f6497.8
Applied egg-rr97.8%
Taylor expanded in phi1 around 0
lower-sin.f6497.8
Simplified97.8%
if 9.5e9 < phi1 Initial program 88.2%
lift--.f64N/A
sin-cos-multN/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6488.3
Applied egg-rr88.3%
Final simplification88.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (- (* (cos phi1) (sin phi2)) (* t_0 (cos (- lambda1 lambda2))))))
(if (<= phi1 -7.4e-6)
(atan2
(* (cos phi2) (- (sin lambda1) (* (cos lambda1) (sin lambda2))))
t_1)
(if (<= phi1 0.00024)
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2))))
(cos phi2))
(- (sin phi2) (* (cos lambda1) t_0)))
(atan2 (/ 1.0 (/ 1.0 (* (cos phi2) (sin (- lambda1 lambda2))))) t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = (cos(phi1) * sin(phi2)) - (t_0 * cos((lambda1 - lambda2)));
double tmp;
if (phi1 <= -7.4e-6) {
tmp = atan2((cos(phi2) * (sin(lambda1) - (cos(lambda1) * sin(lambda2)))), t_1);
} else if (phi1 <= 0.00024) {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2))) * cos(phi2)), (sin(phi2) - (cos(lambda1) * t_0)));
} else {
tmp = atan2((1.0 / (1.0 / (cos(phi2) * sin((lambda1 - lambda2))))), t_1);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi1 <= -7.4e-6) tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - Float64(cos(lambda1) * sin(lambda2)))), t_1); elseif (phi1 <= 0.00024) tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2)))) * cos(phi2)), Float64(sin(phi2) - Float64(cos(lambda1) * t_0))); else tmp = atan(Float64(1.0 / Float64(1.0 / Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))))), t_1); 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[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -7.4e-6], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision], If[LessEqual[phi1, 0.00024], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(1.0 / N[(1.0 / N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]]]]]
\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\_0 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -7.4 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{t\_1}\\
\mathbf{elif}\;\phi_1 \leq 0.00024:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right) \cdot \cos \phi_2}{\sin \phi_2 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\frac{1}{\frac{1}{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}}}{t\_1}\\
\end{array}
\end{array}
if phi1 < -7.4000000000000003e-6Initial program 71.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.f6475.1
Applied egg-rr75.1%
Taylor expanded in lambda2 around 0
lower-sin.f6472.2
Simplified72.2%
if -7.4000000000000003e-6 < phi1 < 2.40000000000000006e-4Initial program 83.1%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6499.0
Applied egg-rr99.0%
Taylor expanded in lambda2 around 0
lower-cos.f6498.7
Simplified98.7%
Taylor expanded in phi1 around 0
lower-sin.f6498.7
Simplified98.7%
if 2.40000000000000006e-4 < phi1 Initial program 86.5%
lift--.f64N/A
sin-cos-multN/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6486.6
Applied egg-rr86.6%
Final simplification88.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -1.1e-5)
(atan2 t_3 (+ t_0 (/ t_1 (/ -1.0 t_2))))
(if (<= phi1 0.00024)
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2))))
(cos phi2))
(- (sin phi2) (* (cos lambda1) t_2)))
(atan2 (/ 1.0 (/ 1.0 t_3)) (- t_0 (* t_2 t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = cos(phi2) * sin(phi1);
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -1.1e-5) {
tmp = atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2))));
} else if (phi1 <= 0.00024) {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2))) * cos(phi2)), (sin(phi2) - (cos(lambda1) * t_2)));
} else {
tmp = atan2((1.0 / (1.0 / t_3)), (t_0 - (t_2 * t_1)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -1.1e-5) tmp = atan(t_3, Float64(t_0 + Float64(t_1 / Float64(-1.0 / t_2)))); elseif (phi1 <= 0.00024) tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2)))) * cos(phi2)), Float64(sin(phi2) - Float64(cos(lambda1) * t_2))); else tmp = atan(Float64(1.0 / Float64(1.0 / t_3)), Float64(t_0 - Float64(t_2 * t_1))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -1.1e-5], N[ArcTan[t$95$3 / N[(t$95$0 + N[(t$95$1 / N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 0.00024], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(1.0 / N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -1.1 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 + \frac{t\_1}{\frac{-1}{t\_2}}}\\
\mathbf{elif}\;\phi_1 \leq 0.00024:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right) \cdot \cos \phi_2}{\sin \phi_2 - \cos \lambda_1 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\frac{1}{\frac{1}{t\_3}}}{t\_0 - t\_2 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -1.1e-5Initial program 71.0%
sin-cos-multN/A
lift--.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6471.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.1
Applied egg-rr71.1%
if -1.1e-5 < phi1 < 2.40000000000000006e-4Initial program 83.1%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6499.0
Applied egg-rr99.0%
Taylor expanded in lambda2 around 0
lower-cos.f6498.7
Simplified98.7%
Taylor expanded in phi1 around 0
lower-sin.f6498.7
Simplified98.7%
if 2.40000000000000006e-4 < phi1 Initial program 86.5%
lift--.f64N/A
sin-cos-multN/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6486.6
Applied egg-rr86.6%
Final simplification88.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -2.8e-22)
(atan2 t_3 (+ t_0 (/ t_1 (/ -1.0 t_2))))
(if (<= phi1 9.8e-43)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(atan2 (/ 1.0 (/ 1.0 t_3)) (- t_0 (* t_2 t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = cos(phi2) * sin(phi1);
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2))));
} else if (phi1 <= 9.8e-43) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = atan2((1.0 / (1.0 / t_3)), (t_0 - (t_2 * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
t_2 = cos(phi2) * sin(phi1)
t_3 = cos(phi2) * sin((lambda1 - lambda2))
if (phi1 <= (-2.8d-22)) then
tmp = atan2(t_3, (t_0 + (t_1 / ((-1.0d0) / t_2))))
else if (phi1 <= 9.8d-43) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else
tmp = atan2((1.0d0 / (1.0d0 / t_3)), (t_0 - (t_2 * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos((lambda1 - lambda2));
double t_2 = Math.cos(phi2) * Math.sin(phi1);
double t_3 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = Math.atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2))));
} else if (phi1 <= 9.8e-43) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else {
tmp = Math.atan2((1.0 / (1.0 / t_3)), (t_0 - (t_2 * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos((lambda1 - lambda2)) t_2 = math.cos(phi2) * math.sin(phi1) t_3 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -2.8e-22: tmp = math.atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2)))) elif phi1 <= 9.8e-43: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) else: tmp = math.atan2((1.0 / (1.0 / t_3)), (t_0 - (t_2 * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -2.8e-22) tmp = atan(t_3, Float64(t_0 + Float64(t_1 / Float64(-1.0 / t_2)))); elseif (phi1 <= 9.8e-43) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = atan(Float64(1.0 / Float64(1.0 / t_3)), Float64(t_0 - Float64(t_2 * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos((lambda1 - lambda2)); t_2 = cos(phi2) * sin(phi1); t_3 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (phi1 <= -2.8e-22) tmp = atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2)))); elseif (phi1 <= 9.8e-43) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = atan2((1.0 / (1.0 / t_3)), (t_0 - (t_2 * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.8e-22], N[ArcTan[t$95$3 / N[(t$95$0 + N[(t$95$1 / N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 9.8e-43], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(1.0 / N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 + \frac{t\_1}{\frac{-1}{t\_2}}}\\
\mathbf{elif}\;\phi_1 \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\frac{1}{\frac{1}{t\_3}}}{t\_0 - t\_2 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -2.79999999999999995e-22Initial program 71.2%
sin-cos-multN/A
lift--.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6471.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3
Applied egg-rr71.3%
if -2.79999999999999995e-22 < phi1 < 9.79999999999999976e-43Initial program 83.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.3
Simplified98.3%
if 9.79999999999999976e-43 < phi1 Initial program 85.2%
lift--.f64N/A
sin-cos-multN/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6485.2
Applied egg-rr85.2%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -2.8e-22)
(atan2 t_3 (+ t_0 (/ t_1 (/ -1.0 t_2))))
(if (<= phi1 9.8e-43)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(atan2 t_3 (- t_0 (* t_2 t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = cos(phi2) * sin(phi1);
double t_3 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2))));
} else if (phi1 <= 9.8e-43) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = atan2(t_3, (t_0 - (t_2 * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos((lambda1 - lambda2))
t_2 = cos(phi2) * sin(phi1)
t_3 = cos(phi2) * sin((lambda1 - lambda2))
if (phi1 <= (-2.8d-22)) then
tmp = atan2(t_3, (t_0 + (t_1 / ((-1.0d0) / t_2))))
else if (phi1 <= 9.8d-43) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else
tmp = atan2(t_3, (t_0 - (t_2 * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos((lambda1 - lambda2));
double t_2 = Math.cos(phi2) * Math.sin(phi1);
double t_3 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = Math.atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2))));
} else if (phi1 <= 9.8e-43) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else {
tmp = Math.atan2(t_3, (t_0 - (t_2 * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos((lambda1 - lambda2)) t_2 = math.cos(phi2) * math.sin(phi1) t_3 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if phi1 <= -2.8e-22: tmp = math.atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2)))) elif phi1 <= 9.8e-43: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) else: tmp = math.atan2(t_3, (t_0 - (t_2 * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -2.8e-22) tmp = atan(t_3, Float64(t_0 + Float64(t_1 / Float64(-1.0 / t_2)))); elseif (phi1 <= 9.8e-43) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = atan(t_3, Float64(t_0 - Float64(t_2 * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos((lambda1 - lambda2)); t_2 = cos(phi2) * sin(phi1); t_3 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (phi1 <= -2.8e-22) tmp = atan2(t_3, (t_0 + (t_1 / (-1.0 / t_2)))); elseif (phi1 <= 9.8e-43) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = atan2(t_3, (t_0 - (t_2 * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.8e-22], N[ArcTan[t$95$3 / N[(t$95$0 + N[(t$95$1 / N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 9.8e-43], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$3 / N[(t$95$0 - N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 + \frac{t\_1}{\frac{-1}{t\_2}}}\\
\mathbf{elif}\;\phi_1 \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_0 - t\_2 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -2.79999999999999995e-22Initial program 71.2%
sin-cos-multN/A
lift--.f64N/A
lift-cos.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
sin-cos-multN/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lower-/.f6471.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3
Applied egg-rr71.3%
if -2.79999999999999995e-22 < phi1 < 9.79999999999999976e-43Initial program 83.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.3
Simplified98.3%
if 9.79999999999999976e-43 < phi1 Initial program 85.2%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (cos lambda1) (* (cos phi2) (sin phi1)))))))
(if (<= lambda1 -1.15e+226)
t_1
(if (<= lambda1 -4.6e+39)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 -4.4e-248)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (<= lambda1 3.5e-16)
(atan2
(* (sin (- lambda2)) (cos phi2))
(fma (* (cos lambda2) (- (cos phi2))) (sin phi1) t_0))
t_1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * (cos(phi2) * sin(phi1)))));
double tmp;
if (lambda1 <= -1.15e+226) {
tmp = t_1;
} else if (lambda1 <= -4.6e+39) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= -4.4e-248) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 3.5e-16) {
tmp = atan2((sin(-lambda2) * cos(phi2)), fma((cos(lambda2) * -cos(phi2)), sin(phi1), t_0));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * Float64(cos(phi2) * sin(phi1))))) tmp = 0.0 if (lambda1 <= -1.15e+226) tmp = t_1; elseif (lambda1 <= -4.6e+39) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= -4.4e-248) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 3.5e-16) tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), fma(Float64(cos(lambda2) * Float64(-cos(phi2))), sin(phi1), t_0)); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -1.15e+226], t$95$1, If[LessEqual[lambda1, -4.6e+39], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, -4.4e-248], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 3.5e-16], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[lambda2], $MachinePrecision] * (-N[Cos[phi2], $MachinePrecision])), $MachinePrecision] * N[Sin[phi1], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot \left(\cos \phi_2 \cdot \sin \phi_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -1.15 \cdot 10^{+226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq -4.6 \cdot 10^{+39}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq -4.4 \cdot 10^{-248}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 3.5 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\cos \lambda_2 \cdot \left(-\cos \phi_2\right), \sin \phi_1, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -1.14999999999999998e226 or 3.50000000000000017e-16 < lambda1 Initial program 68.5%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6484.1
Applied egg-rr84.1%
Taylor expanded in lambda2 around 0
lower-cos.f6484.5
Simplified84.5%
Taylor expanded in lambda2 around 0
lower-sin.f6471.5
Simplified71.5%
if -1.14999999999999998e226 < lambda1 < -4.60000000000000024e39Initial program 34.1%
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.f6466.2
Applied egg-rr66.2%
Taylor expanded in phi1 around 0
lower-sin.f6458.8
Simplified58.8%
if -4.60000000000000024e39 < lambda1 < -4.39999999999999999e-248Initial program 96.8%
Taylor expanded in phi2 around 0
lower-sin.f6488.4
Simplified88.4%
if -4.39999999999999999e-248 < lambda1 < 3.50000000000000017e-16Initial program 99.7%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6486.8
Simplified86.8%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6486.8
Simplified86.8%
lift-cos.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr86.8%
Final simplification78.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2
(atan2 (* (sin lambda1) (cos phi2)) (- t_1 (* (cos lambda1) t_0)))))
(if (<= lambda1 -1.15e+226)
t_2
(if (<= lambda1 -4.6e+39)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 -4.4e-248)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_1 (* (sin phi1) (cos (- lambda1 lambda2)))))
(if (<= lambda1 3.5e-16)
(atan2
(* (sin (- lambda2)) (cos phi2))
(- t_1 (* (cos lambda2) t_0)))
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((sin(lambda1) * cos(phi2)), (t_1 - (cos(lambda1) * t_0)));
double tmp;
if (lambda1 <= -1.15e+226) {
tmp = t_2;
} else if (lambda1 <= -4.6e+39) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= -4.4e-248) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_1 - (sin(phi1) * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 3.5e-16) {
tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - (cos(lambda2) * 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)
t_1 = cos(phi1) * sin(phi2)
t_2 = atan2((sin(lambda1) * cos(phi2)), (t_1 - (cos(lambda1) * t_0)))
if (lambda1 <= (-1.15d+226)) then
tmp = t_2
else if (lambda1 <= (-4.6d+39)) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else if (lambda1 <= (-4.4d-248)) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_1 - (sin(phi1) * cos((lambda1 - lambda2)))))
else if (lambda1 <= 3.5d-16) then
tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - (cos(lambda2) * 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);
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double t_2 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_1 - (Math.cos(lambda1) * t_0)));
double tmp;
if (lambda1 <= -1.15e+226) {
tmp = t_2;
} else if (lambda1 <= -4.6e+39) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else if (lambda1 <= -4.4e-248) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_1 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else if (lambda1 <= 3.5e-16) {
tmp = Math.atan2((Math.sin(-lambda2) * Math.cos(phi2)), (t_1 - (Math.cos(lambda2) * t_0)));
} else {
tmp = t_2;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin(phi1) t_1 = math.cos(phi1) * math.sin(phi2) t_2 = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_1 - (math.cos(lambda1) * t_0))) tmp = 0 if lambda1 <= -1.15e+226: tmp = t_2 elif lambda1 <= -4.6e+39: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) elif lambda1 <= -4.4e-248: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_1 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) elif lambda1 <= 3.5e-16: tmp = math.atan2((math.sin(-lambda2) * math.cos(phi2)), (t_1 - (math.cos(lambda2) * t_0))) 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(sin(lambda1) * cos(phi2)), Float64(t_1 - Float64(cos(lambda1) * t_0))) tmp = 0.0 if (lambda1 <= -1.15e+226) tmp = t_2; elseif (lambda1 <= -4.6e+39) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= -4.4e-248) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_1 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 3.5e-16) tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), Float64(t_1 - Float64(cos(lambda2) * t_0))); else tmp = t_2; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin(phi1); t_1 = cos(phi1) * sin(phi2); t_2 = atan2((sin(lambda1) * cos(phi2)), (t_1 - (cos(lambda1) * t_0))); tmp = 0.0; if (lambda1 <= -1.15e+226) tmp = t_2; elseif (lambda1 <= -4.6e+39) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= -4.4e-248) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_1 - (sin(phi1) * cos((lambda1 - lambda2))))); elseif (lambda1 <= 3.5e-16) tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - (cos(lambda2) * t_0))); else tmp = t_2; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -1.15e+226], t$95$2, If[LessEqual[lambda1, -4.6e+39], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, -4.4e-248], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 3.5e-16], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $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{\sin \lambda_1 \cdot \cos \phi_2}{t\_1 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{if}\;\lambda_1 \leq -1.15 \cdot 10^{+226}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_1 \leq -4.6 \cdot 10^{+39}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq -4.4 \cdot 10^{-248}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 3.5 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{t\_1 - \cos \lambda_2 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda1 < -1.14999999999999998e226 or 3.50000000000000017e-16 < lambda1 Initial program 68.5%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6484.1
Applied egg-rr84.1%
Taylor expanded in lambda2 around 0
lower-cos.f6484.5
Simplified84.5%
Taylor expanded in lambda2 around 0
lower-sin.f6471.5
Simplified71.5%
if -1.14999999999999998e226 < lambda1 < -4.60000000000000024e39Initial program 34.1%
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.f6466.2
Applied egg-rr66.2%
Taylor expanded in phi1 around 0
lower-sin.f6458.8
Simplified58.8%
if -4.60000000000000024e39 < lambda1 < -4.39999999999999999e-248Initial program 96.8%
Taylor expanded in phi2 around 0
lower-sin.f6488.4
Simplified88.4%
if -4.39999999999999999e-248 < lambda1 < 3.50000000000000017e-16Initial program 99.7%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6486.8
Simplified86.8%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6486.8
Simplified86.8%
Final simplification78.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_2 (* (cos phi2) (sin phi1))))
(if (<= lambda1 -1.2e+226)
(atan2 t_1 (- t_0 (* (cos phi2) (* (cos lambda1) (sin phi1)))))
(if (<= lambda1 -1050000000.0)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 3.9e-16)
(atan2 t_1 (- t_0 (* (cos lambda2) t_2)))
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (cos lambda1) t_2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double t_2 = cos(phi2) * sin(phi1);
double tmp;
if (lambda1 <= -1.2e+226) {
tmp = atan2(t_1, (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
} else if (lambda1 <= -1050000000.0) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= 3.9e-16) {
tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2)));
} else {
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * t_2)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
t_2 = cos(phi2) * sin(phi1)
if (lambda1 <= (-1.2d+226)) then
tmp = atan2(t_1, (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1)))))
else if (lambda1 <= (-1050000000.0d0)) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else if (lambda1 <= 3.9d-16) then
tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2)))
else
tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * t_2)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double t_2 = Math.cos(phi2) * Math.sin(phi1);
double tmp;
if (lambda1 <= -1.2e+226) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(phi2) * (Math.cos(lambda1) * Math.sin(phi1)))));
} else if (lambda1 <= -1050000000.0) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else if (lambda1 <= 3.9e-16) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(lambda2) * t_2)));
} else {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - (Math.cos(lambda1) * t_2)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2)) t_2 = math.cos(phi2) * math.sin(phi1) tmp = 0 if lambda1 <= -1.2e+226: tmp = math.atan2(t_1, (t_0 - (math.cos(phi2) * (math.cos(lambda1) * math.sin(phi1))))) elif lambda1 <= -1050000000.0: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) elif lambda1 <= 3.9e-16: tmp = math.atan2(t_1, (t_0 - (math.cos(lambda2) * t_2))) else: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - (math.cos(lambda1) * t_2))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_2 = Float64(cos(phi2) * sin(phi1)) tmp = 0.0 if (lambda1 <= -1.2e+226) tmp = atan(t_1, Float64(t_0 - Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1))))); elseif (lambda1 <= -1050000000.0) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 3.9e-16) tmp = atan(t_1, Float64(t_0 - Float64(cos(lambda2) * t_2))); else tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * t_2))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin((lambda1 - lambda2)); t_2 = cos(phi2) * sin(phi1); tmp = 0.0; if (lambda1 <= -1.2e+226) tmp = atan2(t_1, (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1))))); elseif (lambda1 <= -1050000000.0) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 3.9e-16) tmp = atan2(t_1, (t_0 - (cos(lambda2) * t_2))); else tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * t_2))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -1.2e+226], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, -1050000000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 3.9e-16], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[lambda2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
\mathbf{if}\;\lambda_1 \leq -1.2 \cdot 10^{+226}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\
\mathbf{elif}\;\lambda_1 \leq -1050000000:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \lambda_2 \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot t\_2}\\
\end{array}
\end{array}
if lambda1 < -1.2e226Initial program 87.2%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6494.4
Applied egg-rr94.4%
Taylor expanded in lambda2 around 0
lower-cos.f6495.1
Simplified95.1%
Applied egg-rr87.4%
if -1.2e226 < lambda1 < -1.05e9Initial program 41.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.f6469.7
Applied egg-rr69.7%
Taylor expanded in phi1 around 0
lower-sin.f6459.0
Simplified59.0%
if -1.05e9 < lambda1 < 3.89999999999999977e-16Initial program 98.5%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6498.0
Simplified98.0%
if 3.89999999999999977e-16 < lambda1 Initial program 64.6%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6481.9
Applied egg-rr81.9%
Taylor expanded in lambda2 around 0
lower-cos.f6482.2
Simplified82.2%
Taylor expanded in lambda2 around 0
lower-sin.f6468.2
Simplified68.2%
Final simplification83.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (cos lambda1) (* (cos phi2) (sin phi1)))))))
(if (<= lambda1 -1.15e+226)
t_1
(if (<= lambda1 -4.6e+39)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(if (<= lambda1 0.32)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * (cos(phi2) * sin(phi1)))));
double tmp;
if (lambda1 <= -1.15e+226) {
tmp = t_1;
} else if (lambda1 <= -4.6e+39) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else if (lambda1 <= 0.32) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (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 = cos(phi1) * sin(phi2)
t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * (cos(phi2) * sin(phi1)))))
if (lambda1 <= (-1.15d+226)) then
tmp = t_1
else if (lambda1 <= (-4.6d+39)) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2))
else if (lambda1 <= 0.32d0) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (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.cos(phi1) * Math.sin(phi2);
double t_1 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - (Math.cos(lambda1) * (Math.cos(phi2) * Math.sin(phi1)))));
double tmp;
if (lambda1 <= -1.15e+226) {
tmp = t_1;
} else if (lambda1 <= -4.6e+39) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2)))), Math.sin(phi2));
} else if (lambda1 <= 0.32) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - (math.cos(lambda1) * (math.cos(phi2) * math.sin(phi1))))) tmp = 0 if lambda1 <= -1.15e+226: tmp = t_1 elif lambda1 <= -4.6e+39: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2)))), math.sin(phi2)) elif lambda1 <= 0.32: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * Float64(cos(phi2) * sin(phi1))))) tmp = 0.0 if (lambda1 <= -1.15e+226) tmp = t_1; elseif (lambda1 <= -4.6e+39) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 0.32) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - 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 = cos(phi1) * sin(phi2); t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(lambda1) * (cos(phi2) * sin(phi1))))); tmp = 0.0; if (lambda1 <= -1.15e+226) tmp = t_1; elseif (lambda1 <= -4.6e+39) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2)); elseif (lambda1 <= 0.32) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -1.15e+226], t$95$1, If[LessEqual[lambda1, -4.6e+39], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.32], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - 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 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot \left(\cos \phi_2 \cdot \sin \phi_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -1.15 \cdot 10^{+226}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq -4.6 \cdot 10^{+39}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{elif}\;\lambda_1 \leq 0.32:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -1.14999999999999998e226 or 0.320000000000000007 < lambda1 Initial program 68.2%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6483.5
Applied egg-rr83.5%
Taylor expanded in lambda2 around 0
lower-cos.f6483.9
Simplified83.9%
Taylor expanded in lambda2 around 0
lower-sin.f6471.7
Simplified71.7%
if -1.14999999999999998e226 < lambda1 < -4.60000000000000024e39Initial program 34.1%
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.f6466.2
Applied egg-rr66.2%
Taylor expanded in phi1 around 0
lower-sin.f6458.8
Simplified58.8%
if -4.60000000000000024e39 < lambda1 < 0.320000000000000007Initial program 98.1%
Taylor expanded in phi2 around 0
lower-sin.f6483.6
Simplified83.6%
Final simplification76.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -2.8e-22)
(atan2 t_2 (fma (* (cos phi2) t_0) (- (sin phi1)) t_1))
(if (<= phi1 9.8e-43)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
(atan2 t_2 (- t_1 (* (* (cos phi2) (sin phi1)) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = cos(phi1) * sin(phi2);
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = atan2(t_2, fma((cos(phi2) * t_0), -sin(phi1), t_1));
} else if (phi1 <= 9.8e-43) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
} else {
tmp = atan2(t_2, (t_1 - ((cos(phi2) * sin(phi1)) * t_0)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -2.8e-22) tmp = atan(t_2, fma(Float64(cos(phi2) * t_0), Float64(-sin(phi1)), t_1)); elseif (phi1 <= 9.8e-43) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); else tmp = atan(t_2, Float64(t_1 - Float64(Float64(cos(phi2) * sin(phi1)) * t_0))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.8e-22], N[ArcTan[t$95$2 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 9.8e-43], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\cos \phi_2 \cdot t\_0, -\sin \phi_1, t\_1\right)}\\
\mathbf{elif}\;\phi_1 \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_1 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_0}\\
\end{array}
\end{array}
if phi1 < -2.79999999999999995e-22Initial program 71.2%
lift--.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
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
lift-*.f64N/A
lift--.f64N/A
Applied egg-rr71.3%
if -2.79999999999999995e-22 < phi1 < 9.79999999999999976e-43Initial program 83.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.3
Simplified98.3%
if 9.79999999999999976e-43 < phi1 Initial program 85.2%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -2.8e-22)
t_0
(if (<= phi1 9.8e-43)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = t_0;
} else if (phi1 <= 9.8e-43) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))))
if (phi1 <= (-2.8d-22)) then
tmp = t_0
else if (phi1 <= 9.8d-43) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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.cos(phi2) * Math.sin(phi1)) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = t_0;
} else if (phi1 <= 9.8e-43) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (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.cos(phi2) * math.sin(phi1)) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -2.8e-22: tmp = t_0 elif phi1 <= 9.8e-43: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (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(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -2.8e-22) tmp = t_0; elseif (phi1 <= 9.8e-43) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - 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)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -2.8e-22) tmp = t_0; elseif (phi1 <= 9.8e-43) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -2.8e-22], t$95$0, If[LessEqual[phi1, 9.8e-43], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -2.79999999999999995e-22 or 9.79999999999999976e-43 < phi1 Initial program 77.7%
if -2.79999999999999995e-22 < phi1 < 9.79999999999999976e-43Initial program 83.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.3
Simplified98.3%
Final simplification86.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda2 -0.00018)
(atan2
(* (sin (- lambda2)) (cos phi2))
(fma
(cos phi1)
(sin phi2)
(* (cos phi2) (* (cos lambda2) (- (sin phi1))))))
(if (<= lambda2 29500.0)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(* (cos phi1) (sin phi2))
(* (cos phi2) (* (cos lambda1) (sin phi1)))))
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda2 <= -0.00018) {
tmp = atan2((sin(-lambda2) * cos(phi2)), fma(cos(phi1), sin(phi2), (cos(phi2) * (cos(lambda2) * -sin(phi1)))));
} else if (lambda2 <= 29500.0) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
} else {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), sin(phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda2 <= -0.00018) tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(cos(lambda2) * Float64(-sin(phi1)))))); elseif (lambda2 <= 29500.0) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1))))); else tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), sin(phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda2, -0.00018], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 29500.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[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_2 \leq -0.00018:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \left(-\sin \phi_1\right)\right)\right)}\\
\mathbf{elif}\;\lambda_2 \leq 29500:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\end{array}
\end{array}
if lambda2 < -1.80000000000000011e-4Initial program 56.5%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6457.5
Simplified57.5%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6457.4
Simplified57.4%
if -1.80000000000000011e-4 < lambda2 < 29500Initial program 99.8%
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6499.8
Applied egg-rr99.8%
Taylor expanded in lambda2 around 0
lower-cos.f6499.3
Simplified99.3%
Applied egg-rr99.3%
if 29500 < lambda2 Initial program 56.3%
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.f6479.8
Applied egg-rr79.8%
Taylor expanded in phi1 around 0
lower-sin.f6462.1
Simplified62.1%
Final simplification81.8%
(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 -2.8e-22)
t_0
(if (<= phi1 9.8e-43)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -2.8e-22) {
tmp = t_0;
} else if (phi1 <= 9.8e-43) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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 <= (-2.8d-22)) then
tmp = t_0
else if (phi1 <= 9.8d-43) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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 <= -2.8e-22) {
tmp = t_0;
} else if (phi1 <= 9.8e-43) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (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 <= -2.8e-22: tmp = t_0 elif phi1 <= 9.8e-43: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (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 <= -2.8e-22) tmp = t_0; elseif (phi1 <= 9.8e-43) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - 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 <= -2.8e-22) tmp = t_0; elseif (phi1 <= 9.8e-43) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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, -2.8e-22], t$95$0, If[LessEqual[phi1, 9.8e-43], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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 -2.8 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 9.8 \cdot 10^{-43}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -2.79999999999999995e-22 or 9.79999999999999976e-43 < phi1 Initial program 77.7%
Taylor expanded in phi2 around 0
lower-sin.f6454.8
Simplified54.8%
if -2.79999999999999995e-22 < phi1 < 9.79999999999999976e-43Initial program 83.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.3
Simplified98.3%
Final simplification74.3%
(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.6e+22)
t_0
(if (<= phi1 2.4e-42)
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3.6e+22) {
tmp = t_0;
} else if (phi1 <= 2.4e-42) {
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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.6d+22)) then
tmp = t_0
else if (phi1 <= 2.4d-42) then
tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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.6e+22) {
tmp = t_0;
} else if (phi1 <= 2.4e-42) {
tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (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.6e+22: tmp = t_0 elif phi1 <= 2.4e-42: tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (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.6e+22) tmp = t_0; elseif (phi1 <= 2.4e-42) tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - 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.6e+22) tmp = t_0; elseif (phi1 <= 2.4e-42) tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (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.6e+22], t$95$0, If[LessEqual[phi1, 2.4e-42], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $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.6 \cdot 10^{+22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 2.4 \cdot 10^{-42}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -3.6e22 or 2.40000000000000003e-42 < phi1 Initial program 78.7%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6451.5
Simplified51.5%
Taylor expanded in phi2 around 0
lower-sin.f6451.9
Simplified51.9%
if -3.6e22 < phi1 < 2.40000000000000003e-42Initial 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.f6498.0
Applied egg-rr98.0%
Taylor expanded in phi1 around 0
lower-sin.f6494.3
Simplified94.3%
Final simplification72.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(cos phi2)
(-
(*
lambda1
(fma
(fma lambda1 (* lambda1 -0.16666666666666666) 1.0)
(cos lambda2)
(* lambda1 (* (sin lambda2) 0.5))))
(sin lambda2)))
(sin phi2))))
(if (<= phi2 -5.8e+14)
t_0
(if (<= phi2 0.0077)
(atan2
(sin (- lambda1 lambda2))
(- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2)))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * ((lambda1 * fma(fma(lambda1, (lambda1 * -0.16666666666666666), 1.0), cos(lambda2), (lambda1 * (sin(lambda2) * 0.5)))) - sin(lambda2))), sin(phi2));
double tmp;
if (phi2 <= -5.8e+14) {
tmp = t_0;
} else if (phi2 <= 0.0077) {
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * Float64(Float64(lambda1 * fma(fma(lambda1, Float64(lambda1 * -0.16666666666666666), 1.0), cos(lambda2), Float64(lambda1 * Float64(sin(lambda2) * 0.5)))) - sin(lambda2))), sin(phi2)) tmp = 0.0 if (phi2 <= -5.8e+14) tmp = t_0; elseif (phi2 <= 0.0077) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); 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[(N[(lambda1 * N[(N[(lambda1 * N[(lambda1 * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(lambda1 * N[(N[Sin[lambda2], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -5.8e+14], t$95$0, If[LessEqual[phi2, 0.0077], 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], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(\lambda_1, \lambda_1 \cdot -0.16666666666666666, 1\right), \cos \lambda_2, \lambda_1 \cdot \left(\sin \lambda_2 \cdot 0.5\right)\right) - \sin \lambda_2\right)}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -5.8 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 0.0077:\\
\;\;\;\;\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{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -5.8e14 or 0.0077000000000000002 < phi2 Initial program 73.6%
Taylor expanded in lambda1 around 0
+-commutativeN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
Simplified52.9%
Taylor expanded in phi1 around 0
lower-sin.f6432.8
Simplified32.8%
if -5.8e14 < phi2 < 0.0077000000000000002Initial program 86.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6484.1
Simplified84.1%
Taylor expanded in phi2 around 0
lower-sin.f6484.3
Simplified84.3%
Final simplification60.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda2)) (cos phi2))))
(if (<= phi2 -2.8e+62)
(atan2 t_0 (sin phi2))
(if (<= phi2 3.7e+15)
(atan2
(sin (- lambda1 lambda2))
(- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2
t_0
(- (sin phi2) (* (* (cos phi2) phi1) (cos (- lambda2 lambda1)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(-lambda2) * cos(phi2);
double tmp;
if (phi2 <= -2.8e+62) {
tmp = atan2(t_0, sin(phi2));
} else if (phi2 <= 3.7e+15) {
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * phi1) * cos((lambda2 - lambda1)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin(-lambda2) * cos(phi2)
if (phi2 <= (-2.8d+62)) then
tmp = atan2(t_0, sin(phi2))
else if (phi2 <= 3.7d+15) then
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * phi1) * cos((lambda2 - lambda1)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(-lambda2) * Math.cos(phi2);
double tmp;
if (phi2 <= -2.8e+62) {
tmp = Math.atan2(t_0, Math.sin(phi2));
} else if (phi2 <= 3.7e+15) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - ((Math.cos(phi2) * phi1) * Math.cos((lambda2 - lambda1)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(-lambda2) * math.cos(phi2) tmp = 0 if phi2 <= -2.8e+62: tmp = math.atan2(t_0, math.sin(phi2)) elif phi2 <= 3.7e+15: tmp = math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - ((math.cos(phi2) * phi1) * math.cos((lambda2 - lambda1))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(-lambda2)) * cos(phi2)) tmp = 0.0 if (phi2 <= -2.8e+62) tmp = atan(t_0, sin(phi2)); elseif (phi2 <= 3.7e+15) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(Float64(cos(phi2) * phi1) * cos(Float64(lambda2 - lambda1))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(-lambda2) * cos(phi2); tmp = 0.0; if (phi2 <= -2.8e+62) tmp = atan2(t_0, sin(phi2)); elseif (phi2 <= 3.7e+15) tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = atan2(t_0, (sin(phi2) - ((cos(phi2) * phi1) * cos((lambda2 - lambda1))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2.8e+62], N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 3.7e+15], 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], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * phi1), $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(-\lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_2 \leq -2.8 \cdot 10^{+62}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{elif}\;\phi_2 \leq 3.7 \cdot 10^{+15}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \left(\cos \phi_2 \cdot \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\end{array}
\end{array}
if phi2 < -2.80000000000000014e62Initial program 85.9%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6447.7
Simplified47.7%
Taylor expanded in phi1 around 0
lower-sin.f6430.9
Simplified30.9%
if -2.80000000000000014e62 < phi2 < 3.7e15Initial program 83.1%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6479.0
Simplified79.0%
Taylor expanded in phi2 around 0
lower-sin.f6479.3
Simplified79.3%
if 3.7e15 < phi2 Initial program 67.6%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6440.4
Simplified40.4%
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
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6426.1
Simplified26.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda2)) (cos phi2))))
(if (<= phi2 -2.8e+62)
(atan2 t_0 (sin phi2))
(if (<= phi2 3.7e+15)
(atan2
(sin (- lambda1 lambda2))
(- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2)))))
(atan2 t_0 (- (sin phi2) (* (cos phi2) (* (cos lambda2) phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(-lambda2) * cos(phi2);
double tmp;
if (phi2 <= -2.8e+62) {
tmp = atan2(t_0, sin(phi2));
} else if (phi2 <= 3.7e+15) {
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = atan2(t_0, (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = sin(-lambda2) * cos(phi2)
if (phi2 <= (-2.8d+62)) then
tmp = atan2(t_0, sin(phi2))
else if (phi2 <= 3.7d+15) then
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = atan2(t_0, (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(-lambda2) * Math.cos(phi2);
double tmp;
if (phi2 <= -2.8e+62) {
tmp = Math.atan2(t_0, Math.sin(phi2));
} else if (phi2 <= 3.7e+15) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos(phi2) * (Math.cos(lambda2) * phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(-lambda2) * math.cos(phi2) tmp = 0 if phi2 <= -2.8e+62: tmp = math.atan2(t_0, math.sin(phi2)) elif phi2 <= 3.7e+15: tmp = math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos(phi2) * (math.cos(lambda2) * phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(-lambda2)) * cos(phi2)) tmp = 0.0 if (phi2 <= -2.8e+62) tmp = atan(t_0, sin(phi2)); elseif (phi2 <= 3.7e+15) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(phi2) * Float64(cos(lambda2) * phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(-lambda2) * cos(phi2); tmp = 0.0; if (phi2 <= -2.8e+62) tmp = atan2(t_0, sin(phi2)); elseif (phi2 <= 3.7e+15) tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = atan2(t_0, (sin(phi2) - (cos(phi2) * (cos(lambda2) * phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2.8e+62], N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 3.7e+15], 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], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(-\lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_2 \leq -2.8 \cdot 10^{+62}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{elif}\;\phi_2 \leq 3.7 \cdot 10^{+15}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_2 \cdot \phi_1\right)}\\
\end{array}
\end{array}
if phi2 < -2.80000000000000014e62Initial program 85.9%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6447.7
Simplified47.7%
Taylor expanded in phi1 around 0
lower-sin.f6430.9
Simplified30.9%
if -2.80000000000000014e62 < phi2 < 3.7e15Initial program 83.1%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6479.0
Simplified79.0%
Taylor expanded in phi2 around 0
lower-sin.f6479.3
Simplified79.3%
if 3.7e15 < phi2 Initial program 67.6%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6440.4
Simplified40.4%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6440.3
Simplified40.3%
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
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f6425.7
Simplified25.7%
Final simplification58.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))))
(if (<= phi2 -2.8e+62)
t_0
(if (<= phi2 6.8e+14)
(atan2
(sin (- lambda1 lambda2))
(- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda1 lambda2)))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -2.8e+62) {
tmp = t_0;
} else if (phi2 <= 6.8e+14) {
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} 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(-lambda2) * cos(phi2)), sin(phi2))
if (phi2 <= (-2.8d+62)) then
tmp = t_0
else if (phi2 <= 6.8d+14) then
tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
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(-lambda2) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -2.8e+62) {
tmp = t_0;
} else if (phi2 <= 6.8e+14) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin(-lambda2) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -2.8e+62: tmp = t_0 elif phi2 <= 6.8e+14: tmp = math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -2.8e+62) tmp = t_0; elseif (phi2 <= 6.8e+14) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -2.8e+62) tmp = t_0; elseif (phi2 <= 6.8e+14) tmp = atan2(sin((lambda1 - lambda2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -2.8e+62], t$95$0, If[LessEqual[phi2, 6.8e+14], 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], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -2.8 \cdot 10^{+62}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 6.8 \cdot 10^{+14}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -2.80000000000000014e62 or 6.8e14 < phi2 Initial program 76.3%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6443.8
Simplified43.8%
Taylor expanded in phi1 around 0
lower-sin.f6427.7
Simplified27.7%
if -2.80000000000000014e62 < phi2 < 6.8e14Initial program 83.5%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6479.4
Simplified79.4%
Taylor expanded in phi2 around 0
lower-sin.f6479.7
Simplified79.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))))
(if (<= phi2 -102.0)
t_0
(if (<= phi2 3.1e+14)
(atan2
(sin (- lambda1 lambda2))
(fma (cos (- lambda2 lambda1)) (- (sin phi1)) (* phi2 (cos phi1))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -102.0) {
tmp = t_0;
} else if (phi2 <= 3.1e+14) {
tmp = atan2(sin((lambda1 - lambda2)), fma(cos((lambda2 - lambda1)), -sin(phi1), (phi2 * cos(phi1))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -102.0) tmp = t_0; elseif (phi2 <= 3.1e+14) tmp = atan(sin(Float64(lambda1 - lambda2)), fma(cos(Float64(lambda2 - lambda1)), Float64(-sin(phi1)), Float64(phi2 * cos(phi1)))); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -102.0], t$95$0, If[LessEqual[phi2, 3.1e+14], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -102:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 3.1 \cdot 10^{+14}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \left(\lambda_2 - \lambda_1\right), -\sin \phi_1, \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -102 or 3.1e14 < phi2 Initial program 73.8%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6443.0
Simplified43.0%
Taylor expanded in phi1 around 0
lower-sin.f6426.5
Simplified26.5%
if -102 < phi2 < 3.1e14Initial program 86.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6484.4
Simplified84.4%
Taylor expanded in phi2 around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6484.6
Simplified84.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))))
(if (<= phi2 -0.00062)
t_0
(if (<= phi2 7.2e-12)
(atan2
(sin (- lambda1 lambda2))
(- (* (sin phi1) (cos (- lambda2 lambda1)))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -0.00062) {
tmp = t_0;
} else if (phi2 <= 7.2e-12) {
tmp = atan2(sin((lambda1 - lambda2)), -(sin(phi1) * cos((lambda2 - lambda1))));
} 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(-lambda2) * cos(phi2)), sin(phi2))
if (phi2 <= (-0.00062d0)) then
tmp = t_0
else if (phi2 <= 7.2d-12) then
tmp = atan2(sin((lambda1 - lambda2)), -(sin(phi1) * cos((lambda2 - lambda1))))
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(-lambda2) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -0.00062) {
tmp = t_0;
} else if (phi2 <= 7.2e-12) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), -(Math.sin(phi1) * Math.cos((lambda2 - lambda1))));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin(-lambda2) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -0.00062: tmp = t_0 elif phi2 <= 7.2e-12: tmp = math.atan2(math.sin((lambda1 - lambda2)), -(math.sin(phi1) * math.cos((lambda2 - lambda1)))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -0.00062) tmp = t_0; elseif (phi2 <= 7.2e-12) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(-Float64(sin(phi1) * cos(Float64(lambda2 - lambda1))))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -0.00062) tmp = t_0; elseif (phi2 <= 7.2e-12) tmp = atan2(sin((lambda1 - lambda2)), -(sin(phi1) * cos((lambda2 - lambda1)))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.00062], t$95$0, If[LessEqual[phi2, 7.2e-12], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / (-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.00062:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 7.2 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{-\sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -6.2e-4 or 7.2e-12 < phi2 Initial program 75.1%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6442.8
Simplified42.8%
Taylor expanded in phi1 around 0
lower-sin.f6426.9
Simplified26.9%
if -6.2e-4 < phi2 < 7.2e-12Initial program 85.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6485.4
Simplified85.4%
Taylor expanded in phi2 around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-neg.f64N/A
lower-sin.f6481.0
Simplified81.0%
Final simplification54.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))))
(if (<= phi2 -0.00062)
t_0
(if (<= phi2 7.2e-12)
(atan2 (sin (- lambda1 lambda2)) (* (cos lambda2) (- (sin phi1))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -0.00062) {
tmp = t_0;
} else if (phi2 <= 7.2e-12) {
tmp = atan2(sin((lambda1 - lambda2)), (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((sin(-lambda2) * cos(phi2)), sin(phi2))
if (phi2 <= (-0.00062d0)) then
tmp = t_0
else if (phi2 <= 7.2d-12) then
tmp = atan2(sin((lambda1 - lambda2)), (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.sin(-lambda2) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -0.00062) {
tmp = t_0;
} else if (phi2 <= 7.2e-12) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (Math.cos(lambda2) * -Math.sin(phi1)));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin(-lambda2) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -0.00062: tmp = t_0 elif phi2 <= 7.2e-12: tmp = math.atan2(math.sin((lambda1 - lambda2)), (math.cos(lambda2) * -math.sin(phi1))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -0.00062) tmp = t_0; elseif (phi2 <= 7.2e-12) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(cos(lambda2) * Float64(-sin(phi1)))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -0.00062) tmp = t_0; elseif (phi2 <= 7.2e-12) tmp = atan2(sin((lambda1 - lambda2)), (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[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.00062], t$95$0, If[LessEqual[phi2, 7.2e-12], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[lambda2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.00062:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 7.2 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 \cdot \left(-\sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -6.2e-4 or 7.2e-12 < phi2 Initial program 75.1%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6442.8
Simplified42.8%
Taylor expanded in phi1 around 0
lower-sin.f6426.9
Simplified26.9%
if -6.2e-4 < phi2 < 7.2e-12Initial program 85.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6485.4
Simplified85.4%
Taylor expanded in lambda1 around 0
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
cos-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6476.7
Simplified76.7%
Taylor expanded in phi2 around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-neg.f64N/A
lower-sin.f6472.3
Simplified72.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))))
(if (<= phi2 -5.9e+29)
t_0
(if (<= phi2 6.8e+14) (atan2 (sin (- lambda1 lambda2)) (sin phi2)) t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -5.9e+29) {
tmp = t_0;
} else if (phi2 <= 6.8e+14) {
tmp = atan2(sin((lambda1 - 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(-lambda2) * cos(phi2)), sin(phi2))
if (phi2 <= (-5.9d+29)) then
tmp = t_0
else if (phi2 <= 6.8d+14) then
tmp = atan2(sin((lambda1 - 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(-lambda2) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -5.9e+29) {
tmp = t_0;
} else if (phi2 <= 6.8e+14) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin(-lambda2) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -5.9e+29: tmp = t_0 elif phi2 <= 6.8e+14: tmp = math.atan2(math.sin((lambda1 - lambda2)), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -5.9e+29) tmp = t_0; elseif (phi2 <= 6.8e+14) tmp = atan(sin(Float64(lambda1 - lambda2)), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin(-lambda2) * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -5.9e+29) tmp = t_0; elseif (phi2 <= 6.8e+14) tmp = atan2(sin((lambda1 - 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[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -5.9e+29], t$95$0, If[LessEqual[phi2, 6.8e+14], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -5.9 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 6.8 \cdot 10^{+14}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -5.8999999999999999e29 or 6.8e14 < phi2 Initial program 75.5%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6444.2
Simplified44.2%
Taylor expanded in phi1 around 0
lower-sin.f6427.3
Simplified27.3%
if -5.8999999999999999e29 < phi2 < 6.8e14Initial program 84.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6481.1
Simplified81.1%
Taylor expanded in phi1 around 0
lower-sin.f6449.4
Simplified49.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 -18.5)
(atan2 (sin lambda1) (sin phi2))
(atan2
(sin (- lambda1 lambda2))
(fma phi2 (* -0.16666666666666666 (* phi2 phi2)) phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -18.5) {
tmp = atan2(sin(lambda1), sin(phi2));
} else {
tmp = atan2(sin((lambda1 - lambda2)), fma(phi2, (-0.16666666666666666 * (phi2 * phi2)), phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= -18.5) tmp = atan(sin(lambda1), sin(phi2)); else tmp = atan(sin(Float64(lambda1 - lambda2)), fma(phi2, Float64(-0.16666666666666666 * Float64(phi2 * phi2)), phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -18.5], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq -18.5:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\phi_2, -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right), \phi_2\right)}\\
\end{array}
\end{array}
if phi2 < -18.5Initial program 80.1%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6416.0
Simplified16.0%
Taylor expanded in phi1 around 0
lower-sin.f6413.5
Simplified13.5%
Taylor expanded in lambda2 around 0
lower-sin.f6415.0
Simplified15.0%
if -18.5 < phi2 Initial program 80.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6465.1
Simplified65.1%
Taylor expanded in phi1 around 0
lower-sin.f6440.8
Simplified40.8%
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.3
Simplified40.3%
Final simplification33.7%
(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 80.5%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6452.5
Simplified52.5%
Taylor expanded in phi1 around 0
lower-sin.f6433.7
Simplified33.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(sin (- lambda1 lambda2))
(* -0.16666666666666666 (* phi2 (* phi2 phi2))))))
(if (<= (- lambda1 lambda2) -20000.0)
t_0
(if (<= (- lambda1 lambda2) 2e-102)
(atan2
(fma lambda2 (fma (* lambda1 lambda1) 0.5 -1.0) lambda1)
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2(sin((lambda1 - lambda2)), (-0.16666666666666666 * (phi2 * (phi2 * phi2))));
double tmp;
if ((lambda1 - lambda2) <= -20000.0) {
tmp = t_0;
} else if ((lambda1 - lambda2) <= 2e-102) {
tmp = atan2(fma(lambda2, fma((lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(sin(Float64(lambda1 - lambda2)), Float64(-0.16666666666666666 * Float64(phi2 * Float64(phi2 * phi2)))) tmp = 0.0 if (Float64(lambda1 - lambda2) <= -20000.0) tmp = t_0; elseif (Float64(lambda1 - lambda2) <= 2e-102) tmp = atan(fma(lambda2, fma(Float64(lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2)); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(-0.16666666666666666 * N[(phi2 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(lambda1 - lambda2), $MachinePrecision], -20000.0], t$95$0, If[LessEqual[N[(lambda1 - lambda2), $MachinePrecision], 2e-102], N[ArcTan[N[(lambda2 * N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.5 + -1.0), $MachinePrecision] + lambda1), $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)}{-0.16666666666666666 \cdot \left(\phi_2 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\mathbf{if}\;\lambda_1 - \lambda_2 \leq -20000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 - \lambda_2 \leq 2 \cdot 10^{-102}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\lambda_2, \mathsf{fma}\left(\lambda_1 \cdot \lambda_1, 0.5, -1\right), \lambda_1\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 lambda1 lambda2) < -2e4 or 1.99999999999999987e-102 < (-.f64 lambda1 lambda2) Initial program 74.2%
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-*.f6428.9
Simplified28.9%
Taylor expanded in phi2 around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6428.8
Simplified28.8%
if -2e4 < (-.f64 lambda1 lambda2) < 1.99999999999999987e-102Initial program 99.7%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6469.8
Simplified69.8%
Taylor expanded in phi1 around 0
lower-sin.f6441.5
Simplified41.5%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-negN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
Simplified41.5%
Taylor expanded in lambda2 around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.5
Simplified41.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 3.1e+14)
(atan2
(sin (- lambda1 lambda2))
(fma
phi2
(*
(* phi2 phi2)
(fma (* phi2 phi2) 0.008333333333333333 -0.16666666666666666))
phi2))
(atan2
(sin (- lambda2))
(fma phi2 (* -0.16666666666666666 (* phi2 phi2)) phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 3.1e+14) {
tmp = atan2(sin((lambda1 - lambda2)), fma(phi2, ((phi2 * phi2) * fma((phi2 * phi2), 0.008333333333333333, -0.16666666666666666)), phi2));
} else {
tmp = atan2(sin(-lambda2), fma(phi2, (-0.16666666666666666 * (phi2 * phi2)), phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 3.1e+14) 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(-0.16666666666666666 * Float64(phi2 * phi2)), phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 3.1e+14], 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[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 3.1 \cdot 10^{+14}:\\
\;\;\;\;\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, -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right), \phi_2\right)}\\
\end{array}
\end{array}
if phi2 < 3.1e14Initial program 84.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6462.4
Simplified62.4%
Taylor expanded in phi1 around 0
lower-sin.f6438.9
Simplified38.9%
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-*.f6438.8
Simplified38.8%
if 3.1e14 < phi2 Initial program 66.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6415.5
Simplified15.5%
Taylor expanded in phi1 around 0
lower-sin.f6414.2
Simplified14.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-*.f6412.7
Simplified12.7%
Taylor expanded in lambda1 around 0
lower-sin.f64N/A
lower-neg.f6414.8
Simplified14.8%
Final simplification33.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 -2.4e+18)
(atan2 (fma lambda2 (fma (* lambda1 lambda1) 0.5 -1.0) lambda1) (sin phi2))
(atan2
(sin (- lambda1 lambda2))
(fma phi2 (* -0.16666666666666666 (* phi2 phi2)) phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -2.4e+18) {
tmp = atan2(fma(lambda2, fma((lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2));
} else {
tmp = atan2(sin((lambda1 - lambda2)), fma(phi2, (-0.16666666666666666 * (phi2 * phi2)), phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= -2.4e+18) tmp = atan(fma(lambda2, fma(Float64(lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2)); else tmp = atan(sin(Float64(lambda1 - lambda2)), fma(phi2, Float64(-0.16666666666666666 * Float64(phi2 * phi2)), phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -2.4e+18], N[ArcTan[N[(lambda2 * N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.5 + -1.0), $MachinePrecision] + lambda1), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq -2.4 \cdot 10^{+18}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\lambda_2, \mathsf{fma}\left(\lambda_1 \cdot \lambda_1, 0.5, -1\right), \lambda_1\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\phi_2, -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right), \phi_2\right)}\\
\end{array}
\end{array}
if phi2 < -2.4e18Initial program 78.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6415.8
Simplified15.8%
Taylor expanded in phi1 around 0
lower-sin.f6413.2
Simplified13.2%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-negN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
Simplified12.7%
Taylor expanded in lambda2 around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.8
Simplified11.8%
if -2.4e18 < phi2 Initial program 81.0%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6464.2
Simplified64.2%
Taylor expanded in phi1 around 0
lower-sin.f6440.3
Simplified40.3%
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-*.f6439.6
Simplified39.6%
Final simplification32.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -0.78)
(atan2 (sin lambda1) (fma phi2 (* -0.16666666666666666 (* phi2 phi2)) phi2))
(atan2
(fma lambda2 (fma (* lambda1 lambda1) 0.5 -1.0) lambda1)
(sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -0.78) {
tmp = atan2(sin(lambda1), fma(phi2, (-0.16666666666666666 * (phi2 * phi2)), phi2));
} else {
tmp = atan2(fma(lambda2, fma((lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -0.78) tmp = atan(sin(lambda1), fma(phi2, Float64(-0.16666666666666666 * Float64(phi2 * phi2)), phi2)); else tmp = atan(fma(lambda2, fma(Float64(lambda1 * lambda1), 0.5, -1.0), lambda1), sin(phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -0.78], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(phi2 * N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(lambda2 * N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.5 + -1.0), $MachinePrecision] + lambda1), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -0.78:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\mathsf{fma}\left(\phi_2, -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right), \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\lambda_2, \mathsf{fma}\left(\lambda_1 \cdot \lambda_1, 0.5, -1\right), \lambda_1\right)}{\sin \phi_2}\\
\end{array}
\end{array}
if lambda1 < -0.78000000000000003Initial program 54.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6441.6
Simplified41.6%
Taylor expanded in phi1 around 0
lower-sin.f6428.1
Simplified28.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-*.f6426.0
Simplified26.0%
Taylor expanded in lambda2 around 0
lower-sin.f6426.1
Simplified26.1%
if -0.78000000000000003 < lambda1 Initial program 87.3%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6455.3
Simplified55.3%
Taylor expanded in phi1 around 0
lower-sin.f6435.2
Simplified35.2%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-negN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
Simplified34.1%
Taylor expanded in lambda2 around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6429.4
Simplified29.4%
Final simplification28.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin lambda1) (fma phi2 (* -0.16666666666666666 (* phi2 phi2)) phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin(lambda1), fma(phi2, (-0.16666666666666666 * (phi2 * phi2)), phi2));
}
function code(lambda1, lambda2, phi1, phi2) return atan(sin(lambda1), fma(phi2, Float64(-0.16666666666666666 * Float64(phi2 * phi2)), phi2)) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(phi2 * N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision] + phi2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \lambda_1}{\mathsf{fma}\left(\phi_2, -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right), \phi_2\right)}
\end{array}
Initial program 80.5%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6452.5
Simplified52.5%
Taylor expanded in phi1 around 0
lower-sin.f6433.7
Simplified33.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-*.f6430.9
Simplified30.9%
Taylor expanded in lambda2 around 0
lower-sin.f6423.1
Simplified23.1%
Final simplification23.1%
herbie shell --seed 2024210
(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))))))