
(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 28 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
(*
(cos phi2)
(fma (sin lambda2) (- (cos lambda1)) (* (cos lambda2) (sin lambda1))))
(-
(* (sin phi2) (cos phi1))
(*
(fma (cos lambda2) (cos lambda1) (* (sin lambda1) (sin lambda2)))
(* (sin phi1) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * fma(sin(lambda2), -cos(lambda1), (cos(lambda2) * sin(lambda1)))), ((sin(phi2) * cos(phi1)) - (fma(cos(lambda2), cos(lambda1), (sin(lambda1) * sin(lambda2))) * (sin(phi1) * cos(phi2)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * fma(sin(lambda2), Float64(-cos(lambda1)), Float64(cos(lambda2) * sin(lambda1)))), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(fma(cos(lambda2), cos(lambda1), Float64(sin(lambda1) * sin(lambda2))) * Float64(sin(phi1) * cos(phi2))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * (-N[Cos[lambda1], $MachinePrecision]) + N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_2, -\cos \lambda_1, \cos \lambda_2 \cdot \sin \lambda_1\right)}{\sin \phi_2 \cdot \cos \phi_1 - \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}
\end{array}
Initial program 80.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.6
Applied rewrites88.6%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(-
(* (sin phi2) (cos phi1))
(*
(fma (cos lambda2) (cos lambda1) (* (sin lambda1) (sin lambda2)))
(* (sin phi1) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (fma(cos(lambda2), cos(lambda1), (sin(lambda1) * sin(lambda2))) * (sin(phi1) * cos(phi2)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(fma(cos(lambda2), cos(lambda1), Float64(sin(lambda1) * sin(lambda2))) * Float64(sin(phi1) * cos(phi2))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 \cdot \cos \phi_1 - \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}
\end{array}
Initial program 80.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.6
Applied rewrites88.6%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi2) (cos phi1)))
(t_1 (* (sin phi1) (cos phi2)))
(t_2
(atan2
(*
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos (- lambda1 lambda2)) t_1)))))
(if (<= phi2 -1.06e-5)
t_2
(if (<= phi2 8e-29)
(atan2
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(-
t_0
(*
(fma (cos lambda2) (cos lambda1) (* (sin lambda1) (sin lambda2)))
t_1)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi2) * cos(phi1);
double t_1 = sin(phi1) * cos(phi2);
double t_2 = atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos((lambda1 - lambda2)) * t_1)));
double tmp;
if (phi2 <= -1.06e-5) {
tmp = t_2;
} else if (phi2 <= 8e-29) {
tmp = atan2(fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))), (t_0 - (fma(cos(lambda2), cos(lambda1), (sin(lambda1) * sin(lambda2))) * t_1)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi2) * cos(phi1)) t_1 = Float64(sin(phi1) * cos(phi2)) t_2 = atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(Float64(lambda1 - lambda2)) * t_1))) tmp = 0.0 if (phi2 <= -1.06e-5) tmp = t_2; elseif (phi2 <= 8e-29) tmp = atan(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))), Float64(t_0 - Float64(fma(cos(lambda2), cos(lambda1), Float64(sin(lambda1) * sin(lambda2))) * t_1))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.06e-5], t$95$2, If[LessEqual[phi2, 8e-29], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_2 \cdot \cos \phi_1\\
t_1 := \sin \phi_1 \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \left(\lambda_1 - \lambda_2\right) \cdot t\_1}\\
\mathbf{if}\;\phi_2 \leq -1.06 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_2 \leq 8 \cdot 10^{-29}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right)}{t\_0 - \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi2 < -1.06e-5 or 7.99999999999999955e-29 < phi2 Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.3
Applied rewrites88.3%
if -1.06e-5 < phi2 < 7.99999999999999955e-29Initial program 82.0%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.8
Applied rewrites88.8%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Final simplification93.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi2) (cos phi1)))
(t_1 (* (sin phi1) (cos phi2)))
(t_2
(atan2
(*
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_0 (* (cos lambda1) t_1)))))
(if (<= lambda1 -0.00018)
t_2
(if (<= lambda1 0.00023)
(atan2
(* (- (* (cos lambda2) lambda1) (sin lambda2)) (cos phi2))
(- t_0 (* (fma (sin lambda2) lambda1 (cos lambda2)) t_1)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi2) * cos(phi1);
double t_1 = sin(phi1) * cos(phi2);
double t_2 = atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (cos(lambda1) * t_1)));
double tmp;
if (lambda1 <= -0.00018) {
tmp = t_2;
} else if (lambda1 <= 0.00023) {
tmp = atan2((((cos(lambda2) * lambda1) - sin(lambda2)) * cos(phi2)), (t_0 - (fma(sin(lambda2), lambda1, cos(lambda2)) * t_1)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi2) * cos(phi1)) t_1 = Float64(sin(phi1) * cos(phi2)) t_2 = atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(cos(lambda1) * t_1))) tmp = 0.0 if (lambda1 <= -0.00018) tmp = t_2; elseif (lambda1 <= 0.00023) tmp = atan(Float64(Float64(Float64(cos(lambda2) * lambda1) - sin(lambda2)) * cos(phi2)), Float64(t_0 - Float64(fma(sin(lambda2), lambda1, cos(lambda2)) * t_1))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -0.00018], t$95$2, If[LessEqual[lambda1, 0.00023], N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * lambda1), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Sin[lambda2], $MachinePrecision] * lambda1 + N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_2 \cdot \cos \phi_1\\
t_1 := \sin \phi_1 \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \lambda_1 \cdot t\_1}\\
\mathbf{if}\;\lambda_1 \leq -0.00018:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_1 \leq 0.00023:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \lambda_1 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \mathsf{fma}\left(\sin \lambda_2, \lambda_1, \cos \lambda_2\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda1 < -1.80000000000000011e-4 or 2.3000000000000001e-4 < lambda1 Initial program 62.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6478.5
Applied rewrites78.5%
Taylor expanded in lambda2 around 0
lower-cos.f6477.9
Applied rewrites77.9%
if -1.80000000000000011e-4 < lambda1 < 2.3000000000000001e-4Initial program 99.6%
Taylor expanded in lambda1 around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
sin-negN/A
remove-double-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f6499.6
Applied rewrites99.6%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-negN/A
sin-negN/A
sub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification88.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2))) (cos phi2)) (- (* (sin phi2) (cos phi1)) (* (cos (- lambda1 lambda2)) (* (sin phi1) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.cos(lambda2) * Math.sin(lambda1)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.sin(phi2) * Math.cos(phi1)) - (Math.cos((lambda1 - lambda2)) * (Math.sin(phi1) * Math.cos(phi2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.cos(lambda2) * math.sin(lambda1)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.sin(phi2) * math.cos(phi1)) - (math.cos((lambda1 - lambda2)) * (math.sin(phi1) * math.cos(phi2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * cos(phi2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}
\end{array}
Initial program 80.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.6
Applied rewrites88.6%
Final simplification88.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin phi2) (cos phi1)))
(t_2 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -0.0031)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_1 (* (* t_0 (cos phi2)) (sin phi1))))
(if (<= phi1 1e-16)
(atan2
(* (- (* (cos lambda2) (sin lambda1)) t_2) (cos phi2))
(-
t_1
(*
(*
(* (cos (- lambda2 lambda1)) (cos phi2))
(fma (* -0.16666666666666666 phi1) phi1 1.0))
phi1)))
(atan2
(* (- (sin lambda1) t_2) (cos phi2))
(- t_1 (* t_0 (* (sin phi1) (cos phi2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin(phi2) * cos(phi1);
double t_2 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -0.0031) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1))));
} else if (phi1 <= 1e-16) {
tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - (((cos((lambda2 - lambda1)) * cos(phi2)) * fma((-0.16666666666666666 * phi1), phi1, 1.0)) * phi1)));
} else {
tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2)))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(phi2) * cos(phi1)) t_2 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -0.0031) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_1 - Float64(Float64(t_0 * cos(phi2)) * sin(phi1)))); elseif (phi1 <= 1e-16) tmp = atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), Float64(t_1 - Float64(Float64(Float64(cos(Float64(lambda2 - lambda1)) * cos(phi2)) * fma(Float64(-0.16666666666666666 * phi1), phi1, 1.0)) * phi1))); else tmp = atan(Float64(Float64(sin(lambda1) - t_2) * cos(phi2)), Float64(t_1 - Float64(t_0 * Float64(sin(phi1) * cos(phi2))))); 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[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -0.0031], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1e-16], N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.16666666666666666 * phi1), $MachinePrecision] * phi1 + 1.0), $MachinePrecision]), $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$0 * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \phi_2 \cdot \cos \phi_1\\
t_2 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -0.0031:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1 - \left(t\_0 \cdot \cos \phi_2\right) \cdot \sin \phi_1}\\
\mathbf{elif}\;\phi_1 \leq 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - \left(\left(\cos \left(\lambda_2 - \lambda_1\right) \cdot \cos \phi_2\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot \phi_1, \phi_1, 1\right)\right) \cdot \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - t\_0 \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}\\
\end{array}
\end{array}
if phi1 < -0.00309999999999999989Initial program 73.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.7
Applied rewrites73.7%
if -0.00309999999999999989 < phi1 < 9.9999999999999998e-17Initial program 83.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6499.3
Applied rewrites99.3%
Taylor expanded in phi1 around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.3%
if 9.9999999999999998e-17 < phi1 Initial program 82.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6485.2
Applied rewrites85.2%
Taylor expanded in lambda2 around 0
lower-sin.f6483.9
Applied rewrites83.9%
Final simplification87.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin phi2) (cos phi1)))
(t_2 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -0.000245)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_1 (* (* t_0 (cos phi2)) (sin phi1))))
(if (<= phi1 1e-16)
(atan2
(* (- (* (cos lambda2) (sin lambda1)) t_2) (cos phi2))
(- t_1 (* (* phi1 (cos phi2)) (cos (- lambda2 lambda1)))))
(atan2
(* (- (sin lambda1) t_2) (cos phi2))
(- t_1 (* t_0 (* (sin phi1) (cos phi2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin(phi2) * cos(phi1);
double t_2 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -0.000245) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1))));
} else if (phi1 <= 1e-16) {
tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - ((phi1 * cos(phi2)) * cos((lambda2 - lambda1)))));
} else {
tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((lambda1 - lambda2))
t_1 = sin(phi2) * cos(phi1)
t_2 = cos(lambda1) * sin(lambda2)
if (phi1 <= (-0.000245d0)) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1))))
else if (phi1 <= 1d-16) then
tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - ((phi1 * cos(phi2)) * cos((lambda2 - lambda1)))))
else
tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.sin(phi2) * Math.cos(phi1);
double t_2 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if (phi1 <= -0.000245) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_1 - ((t_0 * Math.cos(phi2)) * Math.sin(phi1))));
} else if (phi1 <= 1e-16) {
tmp = Math.atan2((((Math.cos(lambda2) * Math.sin(lambda1)) - t_2) * Math.cos(phi2)), (t_1 - ((phi1 * Math.cos(phi2)) * Math.cos((lambda2 - lambda1)))));
} else {
tmp = Math.atan2(((Math.sin(lambda1) - t_2) * Math.cos(phi2)), (t_1 - (t_0 * (Math.sin(phi1) * Math.cos(phi2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.sin(phi2) * math.cos(phi1) t_2 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if phi1 <= -0.000245: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_1 - ((t_0 * math.cos(phi2)) * math.sin(phi1)))) elif phi1 <= 1e-16: tmp = math.atan2((((math.cos(lambda2) * math.sin(lambda1)) - t_2) * math.cos(phi2)), (t_1 - ((phi1 * math.cos(phi2)) * math.cos((lambda2 - lambda1))))) else: tmp = math.atan2(((math.sin(lambda1) - t_2) * math.cos(phi2)), (t_1 - (t_0 * (math.sin(phi1) * math.cos(phi2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(phi2) * cos(phi1)) t_2 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -0.000245) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_1 - Float64(Float64(t_0 * cos(phi2)) * sin(phi1)))); elseif (phi1 <= 1e-16) tmp = atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), Float64(t_1 - Float64(Float64(phi1 * cos(phi2)) * cos(Float64(lambda2 - lambda1))))); else tmp = atan(Float64(Float64(sin(lambda1) - t_2) * cos(phi2)), Float64(t_1 - Float64(t_0 * Float64(sin(phi1) * cos(phi2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)); t_1 = sin(phi2) * cos(phi1); t_2 = cos(lambda1) * sin(lambda2); tmp = 0.0; if (phi1 <= -0.000245) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1)))); elseif (phi1 <= 1e-16) tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - ((phi1 * cos(phi2)) * cos((lambda2 - lambda1))))); else tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -0.000245], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1e-16], N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(phi1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$0 * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \phi_2 \cdot \cos \phi_1\\
t_2 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -0.000245:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1 - \left(t\_0 \cdot \cos \phi_2\right) \cdot \sin \phi_1}\\
\mathbf{elif}\;\phi_1 \leq 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - \left(\phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - t\_0 \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}\\
\end{array}
\end{array}
if phi1 < -2.4499999999999999e-4Initial program 74.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
if -2.4499999999999999e-4 < phi1 < 9.9999999999999998e-17Initial program 83.1%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6499.3
Applied rewrites99.3%
Taylor expanded in phi1 around 0
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
sub-negN/A
lower--.f6499.3
Applied rewrites99.3%
if 9.9999999999999998e-17 < phi1 Initial program 82.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6485.2
Applied rewrites85.2%
Taylor expanded in lambda2 around 0
lower-sin.f6483.9
Applied rewrites83.9%
Final simplification87.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin phi2) (cos phi1)))
(t_2 (* (cos lambda1) (sin lambda2))))
(if (<= phi1 -0.000245)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_1 (* (* t_0 (cos phi2)) (sin phi1))))
(if (<= phi1 1.06e-16)
(atan2
(* (- (* (cos lambda2) (sin lambda1)) t_2) (cos phi2))
(- t_1 (* (cos (- lambda2 lambda1)) (sin phi1))))
(atan2
(* (- (sin lambda1) t_2) (cos phi2))
(- t_1 (* t_0 (* (sin phi1) (cos phi2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin(phi2) * cos(phi1);
double t_2 = cos(lambda1) * sin(lambda2);
double tmp;
if (phi1 <= -0.000245) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1))));
} else if (phi1 <= 1.06e-16) {
tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1))));
} else {
tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((lambda1 - lambda2))
t_1 = sin(phi2) * cos(phi1)
t_2 = cos(lambda1) * sin(lambda2)
if (phi1 <= (-0.000245d0)) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1))))
else if (phi1 <= 1.06d-16) then
tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1))))
else
tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.sin(phi2) * Math.cos(phi1);
double t_2 = Math.cos(lambda1) * Math.sin(lambda2);
double tmp;
if (phi1 <= -0.000245) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_1 - ((t_0 * Math.cos(phi2)) * Math.sin(phi1))));
} else if (phi1 <= 1.06e-16) {
tmp = Math.atan2((((Math.cos(lambda2) * Math.sin(lambda1)) - t_2) * Math.cos(phi2)), (t_1 - (Math.cos((lambda2 - lambda1)) * Math.sin(phi1))));
} else {
tmp = Math.atan2(((Math.sin(lambda1) - t_2) * Math.cos(phi2)), (t_1 - (t_0 * (Math.sin(phi1) * Math.cos(phi2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.sin(phi2) * math.cos(phi1) t_2 = math.cos(lambda1) * math.sin(lambda2) tmp = 0 if phi1 <= -0.000245: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_1 - ((t_0 * math.cos(phi2)) * math.sin(phi1)))) elif phi1 <= 1.06e-16: tmp = math.atan2((((math.cos(lambda2) * math.sin(lambda1)) - t_2) * math.cos(phi2)), (t_1 - (math.cos((lambda2 - lambda1)) * math.sin(phi1)))) else: tmp = math.atan2(((math.sin(lambda1) - t_2) * math.cos(phi2)), (t_1 - (t_0 * (math.sin(phi1) * math.cos(phi2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(phi2) * cos(phi1)) t_2 = Float64(cos(lambda1) * sin(lambda2)) tmp = 0.0 if (phi1 <= -0.000245) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_1 - Float64(Float64(t_0 * cos(phi2)) * sin(phi1)))); elseif (phi1 <= 1.06e-16) tmp = atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), Float64(t_1 - Float64(cos(Float64(lambda2 - lambda1)) * sin(phi1)))); else tmp = atan(Float64(Float64(sin(lambda1) - t_2) * cos(phi2)), Float64(t_1 - Float64(t_0 * Float64(sin(phi1) * cos(phi2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)); t_1 = sin(phi2) * cos(phi1); t_2 = cos(lambda1) * sin(lambda2); tmp = 0.0; if (phi1 <= -0.000245) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((t_0 * cos(phi2)) * sin(phi1)))); elseif (phi1 <= 1.06e-16) tmp = atan2((((cos(lambda2) * sin(lambda1)) - t_2) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1)))); else tmp = atan2(((sin(lambda1) - t_2) * cos(phi2)), (t_1 - (t_0 * (sin(phi1) * cos(phi2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -0.000245], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.06e-16], N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$0 * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \phi_2 \cdot \cos \phi_1\\
t_2 := \cos \lambda_1 \cdot \sin \lambda_2\\
\mathbf{if}\;\phi_1 \leq -0.000245:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1 - \left(t\_0 \cdot \cos \phi_2\right) \cdot \sin \phi_1}\\
\mathbf{elif}\;\phi_1 \leq 1.06 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - \cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - t\_2\right) \cdot \cos \phi_2}{t\_1 - t\_0 \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}\\
\end{array}
\end{array}
if phi1 < -2.4499999999999999e-4Initial program 74.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
if -2.4499999999999999e-4 < phi1 < 1.06e-16Initial program 83.1%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6499.3
Applied rewrites99.3%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.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
sub-negN/A
lower--.f6499.3
Applied rewrites99.3%
if 1.06e-16 < phi1 Initial program 82.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6485.2
Applied rewrites85.2%
Taylor expanded in lambda2 around 0
lower-sin.f6483.9
Applied rewrites83.9%
Final simplification87.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma
(sin phi2)
(cos phi1)
(* (* (- (sin phi1)) (cos (- lambda2 lambda1))) (cos phi2))))))
(if (<= phi2 -9e-6)
t_0
(if (<= phi2 0.042)
(atan2
(- (* (cos lambda2) (sin lambda1)) (* (cos lambda1) (sin lambda2)))
(-
(* (sin phi2) (cos phi1))
(* (cos (- lambda1 lambda2)) (* (sin phi1) (cos phi2)))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), ((-sin(phi1) * cos((lambda2 - lambda1))) * cos(phi2))));
double tmp;
if (phi2 <= -9e-6) {
tmp = t_0;
} else if (phi2 <= 0.042) {
tmp = atan2(((cos(lambda2) * sin(lambda1)) - (cos(lambda1) * sin(lambda2))), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(Float64(-sin(phi1)) * cos(Float64(lambda2 - lambda1))) * cos(phi2)))) tmp = 0.0 if (phi2 <= -9e-6) tmp = t_0; elseif (phi2 <= 0.042) tmp = atan(Float64(Float64(cos(lambda2) * sin(lambda1)) - Float64(cos(lambda1) * sin(lambda2))), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * cos(phi2))))); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[(N[((-N[Sin[phi1], $MachinePrecision]) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -9e-6], t$95$0, If[LessEqual[phi2, 0.042], N[ArcTan[N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(\left(-\sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)\right) \cdot \cos \phi_2\right)}\\
\mathbf{if}\;\phi_2 \leq -9 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 0.042:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \lambda_2 \cdot \sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2}{\sin \phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -9.00000000000000023e-6 or 0.0420000000000000026 < phi2 Initial program 78.7%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6418.3
Applied rewrites18.3%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites78.7%
if -9.00000000000000023e-6 < phi2 < 0.0420000000000000026Initial program 82.0%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6482.0
Applied rewrites82.0%
Applied rewrites88.7%
Final simplification83.6%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (cos lambda2) (sin lambda1)) (sin lambda2)) (cos phi2)) (- (* (sin phi2) (cos phi1)) (* (cos (- lambda1 lambda2)) (* (sin phi1) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((cos(lambda2) * sin(lambda1)) - sin(lambda2)) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((cos(lambda2) * sin(lambda1)) - sin(lambda2)) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((((Math.cos(lambda2) * Math.sin(lambda1)) - Math.sin(lambda2)) * Math.cos(phi2)), ((Math.sin(phi2) * Math.cos(phi1)) - (Math.cos((lambda1 - lambda2)) * (Math.sin(phi1) * Math.cos(phi2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((((math.cos(lambda2) * math.sin(lambda1)) - math.sin(lambda2)) * math.cos(phi2)), ((math.sin(phi2) * math.cos(phi1)) - (math.cos((lambda1 - lambda2)) * (math.sin(phi1) * math.cos(phi2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(cos(lambda2) * sin(lambda1)) - sin(lambda2)) * cos(phi2)), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * cos(phi2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((((cos(lambda2) * sin(lambda1)) - sin(lambda2)) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\cos \lambda_2 \cdot \sin \lambda_1 - \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}
\end{array}
Initial program 80.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.6
Applied rewrites88.6%
Taylor expanded in lambda1 around 0
lower-sin.f6482.3
Applied rewrites82.3%
Final simplification82.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (sin lambda1) (* (cos lambda1) (sin lambda2))) (cos phi2)) (- (* (sin phi2) (cos phi1)) (* (cos (- lambda1 lambda2)) (* (sin phi1) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(((sin(lambda1) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(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) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(((Math.sin(lambda1) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((Math.sin(phi2) * Math.cos(phi1)) - (Math.cos((lambda1 - lambda2)) * (Math.sin(phi1) * Math.cos(phi2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(((math.sin(lambda1) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((math.sin(phi2) * math.cos(phi1)) - (math.cos((lambda1 - lambda2)) * (math.sin(phi1) * math.cos(phi2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(sin(lambda1) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * cos(phi2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(((sin(lambda1) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((sin(phi2) * cos(phi1)) - (cos((lambda1 - lambda2)) * (sin(phi1) * cos(phi2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}
\end{array}
Initial program 80.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6488.6
Applied rewrites88.6%
Taylor expanded in lambda2 around 0
lower-sin.f6481.5
Applied rewrites81.5%
Final simplification81.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (- (sin phi1)) (cos (- lambda2 lambda1))))
(t_1
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma (sin phi2) (cos phi1) (* t_0 (cos phi2))))))
(if (<= phi2 -1e-17)
t_1
(if (<= phi2 8.8e-44)
(atan2
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
t_0)
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -sin(phi1) * cos((lambda2 - lambda1));
double t_1 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), (t_0 * cos(phi2))));
double tmp;
if (phi2 <= -1e-17) {
tmp = t_1;
} else if (phi2 <= 8.8e-44) {
tmp = atan2(fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(-sin(phi1)) * cos(Float64(lambda2 - lambda1))) t_1 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(t_0 * cos(phi2)))) tmp = 0.0 if (phi2 <= -1e-17) tmp = t_1; elseif (phi2 <= 8.8e-44) tmp = atan(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))), t_0); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[((-N[Sin[phi1], $MachinePrecision]) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1e-17], t$95$1, If[LessEqual[phi2, 8.8e-44], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)\\
t_1 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, t\_0 \cdot \cos \phi_2\right)}\\
\mathbf{if}\;\phi_2 \leq -1 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 8.8 \cdot 10^{-44}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.00000000000000007e-17 or 8.80000000000000048e-44 < phi2 Initial program 78.4%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6421.9
Applied rewrites21.9%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
Applied rewrites78.5%
if -1.00000000000000007e-17 < phi2 < 8.80000000000000048e-44Initial program 82.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval82.6
Applied rewrites82.6%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6482.5
Applied rewrites82.5%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6482.5
Applied rewrites82.5%
Applied rewrites89.6%
Final simplification83.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1 (* (sin lambda1) (cos phi2)))
(t_2 (* (sin phi2) (cos phi1))))
(if (<= lambda1 -4.2e+49)
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))
(if (<= lambda1 10600000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_2 (* (* (sin phi1) (cos lambda2)) (cos phi2))))
(atan2 t_1 (- t_2 (* (cos (- lambda1 lambda2)) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = sin(lambda1) * cos(phi2);
double t_2 = sin(phi2) * cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
} else if (lambda1 <= 10600000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - ((sin(phi1) * cos(lambda2)) * cos(phi2))));
} else {
tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(phi1) * cos(phi2)
t_1 = sin(lambda1) * cos(phi2)
t_2 = sin(phi2) * cos(phi1)
if (lambda1 <= (-4.2d+49)) then
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
else if (lambda1 <= 10600000.0d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - ((sin(phi1) * cos(lambda2)) * cos(phi2))))
else
tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(phi1) * Math.cos(phi2);
double t_1 = Math.sin(lambda1) * Math.cos(phi2);
double t_2 = Math.sin(phi2) * Math.cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
} else if (lambda1 <= 10600000.0) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_2 - ((Math.sin(phi1) * Math.cos(lambda2)) * Math.cos(phi2))));
} else {
tmp = Math.atan2(t_1, (t_2 - (Math.cos((lambda1 - lambda2)) * t_0)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(phi1) * math.cos(phi2) t_1 = math.sin(lambda1) * math.cos(phi2) t_2 = math.sin(phi2) * math.cos(phi1) tmp = 0 if lambda1 <= -4.2e+49: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) elif lambda1 <= 10600000.0: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_2 - ((math.sin(phi1) * math.cos(lambda2)) * math.cos(phi2)))) else: tmp = math.atan2(t_1, (t_2 - (math.cos((lambda1 - lambda2)) * t_0))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = Float64(sin(lambda1) * cos(phi2)) t_2 = Float64(sin(phi2) * cos(phi1)) tmp = 0.0 if (lambda1 <= -4.2e+49) tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); elseif (lambda1 <= 10600000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_2 - Float64(Float64(sin(phi1) * cos(lambda2)) * cos(phi2)))); else tmp = atan(t_1, Float64(t_2 - Float64(cos(Float64(lambda1 - lambda2)) * t_0))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(phi1) * cos(phi2); t_1 = sin(lambda1) * cos(phi2); t_2 = sin(phi2) * cos(phi1); tmp = 0.0; if (lambda1 <= -4.2e+49) tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); elseif (lambda1 <= 10600000.0) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - ((sin(phi1) * cos(lambda2)) * cos(phi2)))); else tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -4.2e+49], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 10600000.0], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \lambda_1 \cdot \cos \phi_2\\
t_2 := \sin \phi_2 \cdot \cos \phi_1\\
\mathbf{if}\;\lambda_1 \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{elif}\;\lambda_1 \leq 10600000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_2 - \left(\sin \phi_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot t\_0}\\
\end{array}
\end{array}
if lambda1 < -4.20000000000000022e49Initial program 63.9%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6481.1
Applied rewrites81.1%
Taylor expanded in lambda2 around 0
lower-sin.f6465.4
Applied rewrites65.4%
Taylor expanded in lambda2 around 0
lower-cos.f6465.6
Applied rewrites65.6%
if -4.20000000000000022e49 < lambda1 < 1.06e7Initial program 94.1%
Taylor expanded in lambda1 around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-cos.f6494.2
Applied rewrites94.2%
if 1.06e7 < lambda1 Initial program 65.4%
Taylor expanded in lambda2 around 0
lower-sin.f6464.7
Applied rewrites64.7%
Final simplification80.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1 (* (sin lambda1) (cos phi2)))
(t_2 (* (sin phi2) (cos phi1))))
(if (<= lambda1 -4.2e+49)
(atan2 t_1 (- t_2 (* (cos lambda1) t_0)))
(if (<= lambda1 11200000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_2 (* (cos (- lambda2 lambda1)) (sin phi1))))
(atan2 t_1 (- t_2 (* (cos (- lambda1 lambda2)) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = sin(lambda1) * cos(phi2);
double t_2 = sin(phi2) * cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)));
} else if (lambda1 <= 11200000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - (cos((lambda2 - lambda1)) * sin(phi1))));
} else {
tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(phi1) * cos(phi2)
t_1 = sin(lambda1) * cos(phi2)
t_2 = sin(phi2) * cos(phi1)
if (lambda1 <= (-4.2d+49)) then
tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0)))
else if (lambda1 <= 11200000.0d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - (cos((lambda2 - lambda1)) * sin(phi1))))
else
tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(phi1) * Math.cos(phi2);
double t_1 = Math.sin(lambda1) * Math.cos(phi2);
double t_2 = Math.sin(phi2) * Math.cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = Math.atan2(t_1, (t_2 - (Math.cos(lambda1) * t_0)));
} else if (lambda1 <= 11200000.0) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_2 - (Math.cos((lambda2 - lambda1)) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_1, (t_2 - (Math.cos((lambda1 - lambda2)) * t_0)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(phi1) * math.cos(phi2) t_1 = math.sin(lambda1) * math.cos(phi2) t_2 = math.sin(phi2) * math.cos(phi1) tmp = 0 if lambda1 <= -4.2e+49: tmp = math.atan2(t_1, (t_2 - (math.cos(lambda1) * t_0))) elif lambda1 <= 11200000.0: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_2 - (math.cos((lambda2 - lambda1)) * math.sin(phi1)))) else: tmp = math.atan2(t_1, (t_2 - (math.cos((lambda1 - lambda2)) * t_0))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = Float64(sin(lambda1) * cos(phi2)) t_2 = Float64(sin(phi2) * cos(phi1)) tmp = 0.0 if (lambda1 <= -4.2e+49) tmp = atan(t_1, Float64(t_2 - Float64(cos(lambda1) * t_0))); elseif (lambda1 <= 11200000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_2 - Float64(cos(Float64(lambda2 - lambda1)) * sin(phi1)))); else tmp = atan(t_1, Float64(t_2 - Float64(cos(Float64(lambda1 - lambda2)) * t_0))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(phi1) * cos(phi2); t_1 = sin(lambda1) * cos(phi2); t_2 = sin(phi2) * cos(phi1); tmp = 0.0; if (lambda1 <= -4.2e+49) tmp = atan2(t_1, (t_2 - (cos(lambda1) * t_0))); elseif (lambda1 <= 11200000.0) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_2 - (cos((lambda2 - lambda1)) * sin(phi1)))); else tmp = atan2(t_1, (t_2 - (cos((lambda1 - lambda2)) * t_0))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -4.2e+49], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 11200000.0], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \lambda_1 \cdot \cos \phi_2\\
t_2 := \sin \phi_2 \cdot \cos \phi_1\\
\mathbf{if}\;\lambda_1 \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \lambda_1 \cdot t\_0}\\
\mathbf{elif}\;\lambda_1 \leq 11200000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_2 - \cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot t\_0}\\
\end{array}
\end{array}
if lambda1 < -4.20000000000000022e49Initial program 63.9%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6481.1
Applied rewrites81.1%
Taylor expanded in lambda2 around 0
lower-sin.f6465.4
Applied rewrites65.4%
Taylor expanded in lambda2 around 0
lower-cos.f6465.6
Applied rewrites65.6%
if -4.20000000000000022e49 < lambda1 < 1.12e7Initial program 94.1%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
*-commutativeN/A
*-lft-identityN/A
*-inversesN/A
/-rgt-identityN/A
times-fracN/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft-inN/A
metadata-evalN/A
sub-negN/A
lower-cos.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
mul-1-negN/A
Applied rewrites78.1%
if 1.12e7 < lambda1 Initial program 65.4%
Taylor expanded in lambda2 around 0
lower-sin.f6464.7
Applied rewrites64.7%
Final simplification71.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos phi2))) (t_1 (* (sin phi2) (cos phi1))))
(if (<= lambda1 -4.2e+49)
(atan2 t_0 (- t_1 (* (cos lambda1) (* (sin phi1) (cos phi2)))))
(if (<= lambda1 11200000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_1 (* (cos (- lambda2 lambda1)) (sin phi1))))
(atan2 t_0 (- t_1 (* (* (cos phi2) (cos lambda1)) (sin phi1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(phi2);
double t_1 = sin(phi2) * cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = atan2(t_0, (t_1 - (cos(lambda1) * (sin(phi1) * cos(phi2)))));
} else if (lambda1 <= 11200000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1))));
} else {
tmp = atan2(t_0, (t_1 - ((cos(phi2) * cos(lambda1)) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(lambda1) * cos(phi2)
t_1 = sin(phi2) * cos(phi1)
if (lambda1 <= (-4.2d+49)) then
tmp = atan2(t_0, (t_1 - (cos(lambda1) * (sin(phi1) * cos(phi2)))))
else if (lambda1 <= 11200000.0d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1))))
else
tmp = atan2(t_0, (t_1 - ((cos(phi2) * cos(lambda1)) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(lambda1) * Math.cos(phi2);
double t_1 = Math.sin(phi2) * Math.cos(phi1);
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = Math.atan2(t_0, (t_1 - (Math.cos(lambda1) * (Math.sin(phi1) * Math.cos(phi2)))));
} else if (lambda1 <= 11200000.0) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_1 - (Math.cos((lambda2 - lambda1)) * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_0, (t_1 - ((Math.cos(phi2) * Math.cos(lambda1)) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(phi2) t_1 = math.sin(phi2) * math.cos(phi1) tmp = 0 if lambda1 <= -4.2e+49: tmp = math.atan2(t_0, (t_1 - (math.cos(lambda1) * (math.sin(phi1) * math.cos(phi2))))) elif lambda1 <= 11200000.0: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_1 - (math.cos((lambda2 - lambda1)) * math.sin(phi1)))) else: tmp = math.atan2(t_0, (t_1 - ((math.cos(phi2) * math.cos(lambda1)) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(phi2)) t_1 = Float64(sin(phi2) * cos(phi1)) tmp = 0.0 if (lambda1 <= -4.2e+49) tmp = atan(t_0, Float64(t_1 - Float64(cos(lambda1) * Float64(sin(phi1) * cos(phi2))))); elseif (lambda1 <= 11200000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_1 - Float64(cos(Float64(lambda2 - lambda1)) * sin(phi1)))); else tmp = atan(t_0, Float64(t_1 - Float64(Float64(cos(phi2) * cos(lambda1)) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(lambda1) * cos(phi2); t_1 = sin(phi2) * cos(phi1); tmp = 0.0; if (lambda1 <= -4.2e+49) tmp = atan2(t_0, (t_1 - (cos(lambda1) * (sin(phi1) * cos(phi2))))); elseif (lambda1 <= 11200000.0) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - (cos((lambda2 - lambda1)) * sin(phi1)))); else tmp = atan2(t_0, (t_1 - ((cos(phi2) * cos(lambda1)) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -4.2e+49], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[Cos[lambda1], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 11200000.0], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \phi_2\\
t_1 := \sin \phi_2 \cdot \cos \phi_1\\
\mathbf{if}\;\lambda_1 \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \cos \lambda_1 \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 11200000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1 - \cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \left(\cos \phi_2 \cdot \cos \lambda_1\right) \cdot \sin \phi_1}\\
\end{array}
\end{array}
if lambda1 < -4.20000000000000022e49Initial program 63.9%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6481.1
Applied rewrites81.1%
Taylor expanded in lambda2 around 0
lower-sin.f6465.4
Applied rewrites65.4%
Taylor expanded in lambda2 around 0
lower-cos.f6465.6
Applied rewrites65.6%
if -4.20000000000000022e49 < lambda1 < 1.12e7Initial program 94.1%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
*-commutativeN/A
*-lft-identityN/A
*-inversesN/A
/-rgt-identityN/A
times-fracN/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft-inN/A
metadata-evalN/A
sub-negN/A
lower-cos.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
mul-1-negN/A
Applied rewrites78.1%
if 1.12e7 < lambda1 Initial program 65.4%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6478.0
Applied rewrites78.0%
Taylor expanded in lambda2 around 0
lower-sin.f6464.7
Applied rewrites64.7%
Taylor expanded in lambda2 around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-sin.f6464.6
Applied rewrites64.6%
Final simplification71.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi2) (cos phi1)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (* (cos phi2) (cos lambda1)) (sin phi1))))))
(if (<= lambda1 -4.2e+49)
t_1
(if (<= lambda1 11200000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_0 (* (cos (- lambda2 lambda1)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi2) * cos(phi1);
double t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * cos(lambda1)) * sin(phi1))));
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = t_1;
} else if (lambda1 <= 11200000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_0 - (cos((lambda2 - lambda1)) * sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(phi2) * cos(phi1)
t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * cos(lambda1)) * sin(phi1))))
if (lambda1 <= (-4.2d+49)) then
tmp = t_1
else if (lambda1 <= 11200000.0d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_0 - (cos((lambda2 - lambda1)) * sin(phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(phi2) * Math.cos(phi1);
double t_1 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - ((Math.cos(phi2) * Math.cos(lambda1)) * Math.sin(phi1))));
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = t_1;
} else if (lambda1 <= 11200000.0) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_0 - (Math.cos((lambda2 - lambda1)) * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(phi2) * math.cos(phi1) t_1 = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - ((math.cos(phi2) * math.cos(lambda1)) * math.sin(phi1)))) tmp = 0 if lambda1 <= -4.2e+49: tmp = t_1 elif lambda1 <= 11200000.0: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_0 - (math.cos((lambda2 - lambda1)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi2) * cos(phi1)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(Float64(cos(phi2) * cos(lambda1)) * sin(phi1)))) tmp = 0.0 if (lambda1 <= -4.2e+49) tmp = t_1; elseif (lambda1 <= 11200000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_0 - Float64(cos(Float64(lambda2 - lambda1)) * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(phi2) * cos(phi1); t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((cos(phi2) * cos(lambda1)) * sin(phi1)))); tmp = 0.0; if (lambda1 <= -4.2e+49) tmp = t_1; elseif (lambda1 <= 11200000.0) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_0 - (cos((lambda2 - lambda1)) * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -4.2e+49], t$95$1, If[LessEqual[lambda1, 11200000.0], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_2 \cdot \cos \phi_1\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \left(\cos \phi_2 \cdot \cos \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{if}\;\lambda_1 \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 11200000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -4.20000000000000022e49 or 1.12e7 < lambda1 Initial program 64.9%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6479.1
Applied rewrites79.1%
Taylor expanded in lambda2 around 0
lower-sin.f6464.9
Applied rewrites64.9%
Taylor expanded in lambda2 around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
lower-sin.f6465.0
Applied rewrites65.0%
if -4.20000000000000022e49 < lambda1 < 1.12e7Initial program 94.1%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
*-commutativeN/A
*-lft-identityN/A
*-inversesN/A
/-rgt-identityN/A
times-fracN/A
*-rgt-identityN/A
associate-*r/N/A
distribute-lft-inN/A
metadata-evalN/A
sub-negN/A
lower-cos.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
mul-1-negN/A
Applied rewrites78.1%
Final simplification71.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda2 lambda1)))
(t_1
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma (* (- 0.0) t_0) 0.5 (* (sin phi2) (cos phi1))))))
(if (<= phi2 -1.15e-14)
t_1
(if (<= phi2 2.15e-48)
(atan2
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(* (- (sin phi1)) t_0))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda2 - lambda1));
double t_1 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma((-0.0 * t_0), 0.5, (sin(phi2) * cos(phi1))));
double tmp;
if (phi2 <= -1.15e-14) {
tmp = t_1;
} else if (phi2 <= 2.15e-48) {
tmp = atan2(fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))), (-sin(phi1) * t_0));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda2 - lambda1)) t_1 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(Float64(Float64(-0.0) * t_0), 0.5, Float64(sin(phi2) * cos(phi1)))) tmp = 0.0 if (phi2 <= -1.15e-14) tmp = t_1; elseif (phi2 <= 2.15e-48) tmp = atan(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))), Float64(Float64(-sin(phi1)) * t_0)); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[((-0.0) * t$95$0), $MachinePrecision] * 0.5 + N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.15e-14], t$95$1, If[LessEqual[phi2, 2.15e-48], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-N[Sin[phi1], $MachinePrecision]) * t$95$0), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_2 - \lambda_1\right)\\
t_1 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\left(-0\right) \cdot t\_0, 0.5, \sin \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{if}\;\phi_2 \leq -1.15 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 2.15 \cdot 10^{-48}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right)}{\left(-\sin \phi_1\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.14999999999999999e-14 or 2.15e-48 < phi2 Initial program 78.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval54.8
Applied rewrites54.8%
Taylor expanded in phi1 around 0
sin-negN/A
unsub-negN/A
lower--.f64N/A
lower-sin.f64N/A
lower-sin.f6454.9
Applied rewrites54.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
Applied rewrites54.9%
if -1.14999999999999999e-14 < phi2 < 2.15e-48Initial program 83.2%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval83.2
Applied rewrites83.2%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6483.0
Applied rewrites83.0%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6483.0
Applied rewrites83.0%
Applied rewrites90.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1
(atan2
(* t_0 (cos phi2))
(fma
(* (- 0.0) (cos (- lambda2 lambda1)))
0.5
(* (sin phi2) (cos phi1))))))
(if (<= phi2 -1.15e-14)
t_1
(if (<= phi2 29000000.0)
(atan2
t_0
(*
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))
(- (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), fma((-0.0 * cos((lambda2 - lambda1))), 0.5, (sin(phi2) * cos(phi1))));
double tmp;
if (phi2 <= -1.15e-14) {
tmp = t_1;
} else if (phi2 <= 29000000.0) {
tmp = atan2(t_0, (fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))) * -sin(phi1)));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), fma(Float64(Float64(-0.0) * cos(Float64(lambda2 - lambda1))), 0.5, Float64(sin(phi2) * cos(phi1)))) tmp = 0.0 if (phi2 <= -1.15e-14) tmp = t_1; elseif (phi2 <= 29000000.0) tmp = atan(t_0, Float64(fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1))) * Float64(-sin(phi1)))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[((-0.0) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.15e-14], t$95$1, If[LessEqual[phi2, 29000000.0], N[ArcTan[t$95$0 / N[(N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\mathsf{fma}\left(\left(-0\right) \cdot \cos \left(\lambda_2 - \lambda_1\right), 0.5, \sin \phi_2 \cdot \cos \phi_1\right)}\\
\mathbf{if}\;\phi_2 \leq -1.15 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 29000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right) \cdot \left(-\sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.14999999999999999e-14 or 2.9e7 < phi2 Initial program 79.0%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval55.0
Applied rewrites55.0%
Taylor expanded in phi1 around 0
sin-negN/A
unsub-negN/A
lower--.f64N/A
lower-sin.f64N/A
lower-sin.f6455.0
Applied rewrites55.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
Applied rewrites55.0%
if -1.14999999999999999e-14 < phi2 < 2.9e7Initial program 81.7%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval81.1
Applied rewrites81.1%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6481.0
Applied rewrites81.0%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6481.0
Applied rewrites81.0%
Applied rewrites81.4%
Final simplification67.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda2 lambda1)))
(t_1 (* (sin phi2) (cos phi1)))
(t_2 (sin (- lambda1 lambda2)))
(t_3 (atan2 (* t_2 (cos phi2)) (fma (* (- 0.0) t_0) 0.5 t_1))))
(if (<= phi2 -0.0055)
t_3
(if (<= phi2 29000000.0) (atan2 t_2 (- t_1 (* t_0 (sin phi1)))) t_3))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda2 - lambda1));
double t_1 = sin(phi2) * cos(phi1);
double t_2 = sin((lambda1 - lambda2));
double t_3 = atan2((t_2 * cos(phi2)), fma((-0.0 * t_0), 0.5, t_1));
double tmp;
if (phi2 <= -0.0055) {
tmp = t_3;
} else if (phi2 <= 29000000.0) {
tmp = atan2(t_2, (t_1 - (t_0 * sin(phi1))));
} else {
tmp = t_3;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda2 - lambda1)) t_1 = Float64(sin(phi2) * cos(phi1)) t_2 = sin(Float64(lambda1 - lambda2)) t_3 = atan(Float64(t_2 * cos(phi2)), fma(Float64(Float64(-0.0) * t_0), 0.5, t_1)) tmp = 0.0 if (phi2 <= -0.0055) tmp = t_3; elseif (phi2 <= 29000000.0) tmp = atan(t_2, Float64(t_1 - Float64(t_0 * sin(phi1)))); else tmp = t_3; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(t$95$2 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[((-0.0) * t$95$0), $MachinePrecision] * 0.5 + t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.0055], t$95$3, If[LessEqual[phi2, 29000000.0], N[ArcTan[t$95$2 / N[(t$95$1 - N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_2 - \lambda_1\right)\\
t_1 := \sin \phi_2 \cdot \cos \phi_1\\
t_2 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_3 := \tan^{-1}_* \frac{t\_2 \cdot \cos \phi_2}{\mathsf{fma}\left(\left(-0\right) \cdot t\_0, 0.5, t\_1\right)}\\
\mathbf{if}\;\phi_2 \leq -0.0055:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\phi_2 \leq 29000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_1 - t\_0 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if phi2 < -0.0054999999999999997 or 2.9e7 < phi2 Initial program 78.5%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval53.9
Applied rewrites53.9%
Taylor expanded in phi1 around 0
sin-negN/A
unsub-negN/A
lower--.f64N/A
lower-sin.f64N/A
lower-sin.f6454.0
Applied rewrites54.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
Applied rewrites54.0%
if -0.0054999999999999997 < phi2 < 2.9e7Initial program 82.1%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6481.6
Applied rewrites81.6%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.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
sub-negN/A
lower--.f6481.6
Applied rewrites81.6%
Final simplification67.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin lambda1) (cos phi2)))
(t_1 (cos (- lambda2 lambda1)))
(t_2 (* (sin phi2) (cos phi1))))
(if (<= phi2 -5.7e+88)
(atan2 t_0 (- t_2 (* (cos (- lambda1 lambda2)) phi1)))
(if (<= phi2 320000000.0)
(atan2 (sin (- lambda1 lambda2)) (- t_2 (* t_1 (sin phi1))))
(atan2 t_0 (- (sin phi2) (* (* phi1 (cos phi2)) t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(lambda1) * cos(phi2);
double t_1 = cos((lambda2 - lambda1));
double t_2 = sin(phi2) * cos(phi1);
double tmp;
if (phi2 <= -5.7e+88) {
tmp = atan2(t_0, (t_2 - (cos((lambda1 - lambda2)) * phi1)));
} else if (phi2 <= 320000000.0) {
tmp = atan2(sin((lambda1 - lambda2)), (t_2 - (t_1 * sin(phi1))));
} else {
tmp = atan2(t_0, (sin(phi2) - ((phi1 * cos(phi2)) * t_1)));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(lambda1) * cos(phi2)
t_1 = cos((lambda2 - lambda1))
t_2 = sin(phi2) * cos(phi1)
if (phi2 <= (-5.7d+88)) then
tmp = atan2(t_0, (t_2 - (cos((lambda1 - lambda2)) * phi1)))
else if (phi2 <= 320000000.0d0) then
tmp = atan2(sin((lambda1 - lambda2)), (t_2 - (t_1 * sin(phi1))))
else
tmp = atan2(t_0, (sin(phi2) - ((phi1 * cos(phi2)) * t_1)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin(lambda1) * Math.cos(phi2);
double t_1 = Math.cos((lambda2 - lambda1));
double t_2 = Math.sin(phi2) * Math.cos(phi1);
double tmp;
if (phi2 <= -5.7e+88) {
tmp = Math.atan2(t_0, (t_2 - (Math.cos((lambda1 - lambda2)) * phi1)));
} else if (phi2 <= 320000000.0) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (t_2 - (t_1 * Math.sin(phi1))));
} else {
tmp = Math.atan2(t_0, (Math.sin(phi2) - ((phi1 * Math.cos(phi2)) * t_1)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin(lambda1) * math.cos(phi2) t_1 = math.cos((lambda2 - lambda1)) t_2 = math.sin(phi2) * math.cos(phi1) tmp = 0 if phi2 <= -5.7e+88: tmp = math.atan2(t_0, (t_2 - (math.cos((lambda1 - lambda2)) * phi1))) elif phi2 <= 320000000.0: tmp = math.atan2(math.sin((lambda1 - lambda2)), (t_2 - (t_1 * math.sin(phi1)))) else: tmp = math.atan2(t_0, (math.sin(phi2) - ((phi1 * math.cos(phi2)) * t_1))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(lambda1) * cos(phi2)) t_1 = cos(Float64(lambda2 - lambda1)) t_2 = Float64(sin(phi2) * cos(phi1)) tmp = 0.0 if (phi2 <= -5.7e+88) tmp = atan(t_0, Float64(t_2 - Float64(cos(Float64(lambda1 - lambda2)) * phi1))); elseif (phi2 <= 320000000.0) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(t_2 - Float64(t_1 * sin(phi1)))); else tmp = atan(t_0, Float64(sin(phi2) - Float64(Float64(phi1 * cos(phi2)) * t_1))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin(lambda1) * cos(phi2); t_1 = cos((lambda2 - lambda1)); t_2 = sin(phi2) * cos(phi1); tmp = 0.0; if (phi2 <= -5.7e+88) tmp = atan2(t_0, (t_2 - (cos((lambda1 - lambda2)) * phi1))); elseif (phi2 <= 320000000.0) tmp = atan2(sin((lambda1 - lambda2)), (t_2 - (t_1 * sin(phi1)))); else tmp = atan2(t_0, (sin(phi2) - ((phi1 * cos(phi2)) * t_1))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -5.7e+88], N[ArcTan[t$95$0 / N[(t$95$2 - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * phi1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 320000000.0], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[(t$95$1 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(phi1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \lambda_1 \cdot \cos \phi_2\\
t_1 := \cos \left(\lambda_2 - \lambda_1\right)\\
t_2 := \sin \phi_2 \cdot \cos \phi_1\\
\mathbf{if}\;\phi_2 \leq -5.7 \cdot 10^{+88}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \phi_1}\\
\mathbf{elif}\;\phi_2 \leq 320000000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_2 - t\_1 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \left(\phi_1 \cdot \cos \phi_2\right) \cdot t\_1}\\
\end{array}
\end{array}
if phi2 < -5.70000000000000021e88Initial program 72.4%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6481.4
Applied rewrites81.4%
Taylor expanded in lambda2 around 0
lower-sin.f6449.9
Applied rewrites49.9%
Taylor expanded in phi1 around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
remove-double-negN/A
neg-mul-1N/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6433.4
Applied rewrites33.4%
Taylor expanded in phi2 around 0
Applied rewrites35.9%
if -5.70000000000000021e88 < phi2 < 3.2e8Initial program 82.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6474.0
Applied rewrites74.0%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.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
sub-negN/A
lower--.f6474.1
Applied rewrites74.1%
if 3.2e8 < phi2 Initial program 80.5%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6490.9
Applied rewrites90.9%
Taylor expanded in lambda2 around 0
lower-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in phi1 around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
remove-double-negN/A
neg-mul-1N/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6442.5
Applied rewrites42.5%
Taylor expanded in phi1 around 0
lower-sin.f6442.5
Applied rewrites42.5%
Final simplification59.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda2 lambda1)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- (sin phi2) (* (* phi1 (cos phi2)) t_0)))))
(if (<= phi2 -1.3e+67)
t_1
(if (<= phi2 320000000.0)
(atan2
(sin (- lambda1 lambda2))
(- (* (sin phi2) (cos phi1)) (* t_0 (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda2 - lambda1));
double t_1 = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - ((phi1 * cos(phi2)) * t_0)));
double tmp;
if (phi2 <= -1.3e+67) {
tmp = t_1;
} else if (phi2 <= 320000000.0) {
tmp = atan2(sin((lambda1 - lambda2)), ((sin(phi2) * cos(phi1)) - (t_0 * sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((lambda2 - lambda1))
t_1 = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - ((phi1 * cos(phi2)) * t_0)))
if (phi2 <= (-1.3d+67)) then
tmp = t_1
else if (phi2 <= 320000000.0d0) then
tmp = atan2(sin((lambda1 - lambda2)), ((sin(phi2) * cos(phi1)) - (t_0 * sin(phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda2 - lambda1));
double t_1 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (Math.sin(phi2) - ((phi1 * Math.cos(phi2)) * t_0)));
double tmp;
if (phi2 <= -1.3e+67) {
tmp = t_1;
} else if (phi2 <= 320000000.0) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.sin(phi2) * Math.cos(phi1)) - (t_0 * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda2 - lambda1)) t_1 = math.atan2((math.sin(lambda1) * math.cos(phi2)), (math.sin(phi2) - ((phi1 * math.cos(phi2)) * t_0))) tmp = 0 if phi2 <= -1.3e+67: tmp = t_1 elif phi2 <= 320000000.0: tmp = math.atan2(math.sin((lambda1 - lambda2)), ((math.sin(phi2) * math.cos(phi1)) - (t_0 * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda2 - lambda1)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(sin(phi2) - Float64(Float64(phi1 * cos(phi2)) * t_0))) tmp = 0.0 if (phi2 <= -1.3e+67) tmp = t_1; elseif (phi2 <= 320000000.0) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(sin(phi2) * cos(phi1)) - Float64(t_0 * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda2 - lambda1)); t_1 = atan2((sin(lambda1) * cos(phi2)), (sin(phi2) - ((phi1 * cos(phi2)) * t_0))); tmp = 0.0; if (phi2 <= -1.3e+67) tmp = t_1; elseif (phi2 <= 320000000.0) tmp = atan2(sin((lambda1 - lambda2)), ((sin(phi2) * cos(phi1)) - (t_0 * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(phi1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.3e+67], t$95$1, If[LessEqual[phi2, 320000000.0], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_2 - \lambda_1\right)\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\sin \phi_2 - \left(\phi_1 \cdot \cos \phi_2\right) \cdot t\_0}\\
\mathbf{if}\;\phi_2 \leq -1.3 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 320000000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 \cdot \cos \phi_1 - t\_0 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.3e67 or 3.2e8 < phi2 Initial program 77.6%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6487.1
Applied rewrites87.1%
Taylor expanded in lambda2 around 0
lower-sin.f6449.2
Applied rewrites49.2%
Taylor expanded in phi1 around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
sub-negN/A
remove-double-negN/A
neg-mul-1N/A
distribute-neg-inN/A
+-commutativeN/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6438.0
Applied rewrites38.0%
Taylor expanded in phi1 around 0
lower-sin.f6438.0
Applied rewrites38.0%
if -1.3e67 < phi2 < 3.2e8Initial program 82.5%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6475.3
Applied rewrites75.3%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.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
sub-negN/A
lower--.f6475.4
Applied rewrites75.4%
Final simplification58.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (- (sin phi1))))
(if (<= lambda2 -0.00045)
(atan2
(sin (* (- (/ lambda1 lambda2) 1.0) lambda2))
(* t_0 (cos (- lambda2 lambda1))))
(atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (* (cos lambda1) t_0)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -sin(phi1);
double tmp;
if (lambda2 <= -0.00045) {
tmp = atan2(sin((((lambda1 / lambda2) - 1.0) * lambda2)), (t_0 * cos((lambda2 - lambda1))));
} else {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (cos(lambda1) * t_0));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = -sin(phi1)
if (lambda2 <= (-0.00045d0)) then
tmp = atan2(sin((((lambda1 / lambda2) - 1.0d0) * lambda2)), (t_0 * cos((lambda2 - lambda1))))
else
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (cos(lambda1) * t_0))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -Math.sin(phi1);
double tmp;
if (lambda2 <= -0.00045) {
tmp = Math.atan2(Math.sin((((lambda1 / lambda2) - 1.0) * lambda2)), (t_0 * Math.cos((lambda2 - lambda1))));
} else {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (Math.cos(lambda1) * t_0));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = -math.sin(phi1) tmp = 0 if lambda2 <= -0.00045: tmp = math.atan2(math.sin((((lambda1 / lambda2) - 1.0) * lambda2)), (t_0 * math.cos((lambda2 - lambda1)))) else: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (math.cos(lambda1) * t_0)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(-sin(phi1)) tmp = 0.0 if (lambda2 <= -0.00045) tmp = atan(sin(Float64(Float64(Float64(lambda1 / lambda2) - 1.0) * lambda2)), Float64(t_0 * cos(Float64(lambda2 - lambda1)))); else tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(cos(lambda1) * t_0)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = -sin(phi1); tmp = 0.0; if (lambda2 <= -0.00045) tmp = atan2(sin((((lambda1 / lambda2) - 1.0) * lambda2)), (t_0 * cos((lambda2 - lambda1)))); else tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (cos(lambda1) * t_0)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = (-N[Sin[phi1], $MachinePrecision])}, If[LessEqual[lambda2, -0.00045], N[ArcTan[N[Sin[N[(N[(N[(lambda1 / lambda2), $MachinePrecision] - 1.0), $MachinePrecision] * lambda2), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[lambda1], $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\sin \phi_1\\
\mathbf{if}\;\lambda_2 \leq -0.00045:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\left(\frac{\lambda_1}{\lambda_2} - 1\right) \cdot \lambda_2\right)}{t\_0 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \lambda_1 \cdot t\_0}\\
\end{array}
\end{array}
if lambda2 < -4.4999999999999999e-4Initial program 64.7%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval53.4
Applied rewrites53.4%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6444.0
Applied rewrites44.0%
Taylor expanded in lambda2 around inf
Applied rewrites45.6%
if -4.4999999999999999e-4 < lambda2 Initial program 85.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval71.9
Applied rewrites71.9%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6452.7
Applied rewrites52.7%
Taylor expanded in lambda2 around 0
Applied rewrites51.1%
Final simplification49.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (* (- (sin phi1)) (cos (- lambda2 lambda1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), (-sin(phi1) * cos((lambda2 - lambda1))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (-sin(phi1) * cos((lambda2 - lambda1))))
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.sin(phi1) * Math.cos((lambda2 - lambda1))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (-math.sin(phi1) * math.cos((lambda2 - lambda1))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(-sin(phi1)) * cos(Float64(lambda2 - lambda1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (-sin(phi1) * cos((lambda2 - lambda1)))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[((-N[Sin[phi1], $MachinePrecision]) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\left(-\sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}
\end{array}
Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval67.5
Applied rewrites67.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6450.9
Applied rewrites50.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda2 lambda1))) (t_1 (sin (- lambda1 lambda2))))
(if (<= phi2 7400000000000.0)
(atan2 t_1 (* (- (sin phi1)) t_0))
(atan2 (* t_1 (cos phi2)) (* (- phi1) t_0)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda2 - lambda1));
double t_1 = sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 7400000000000.0) {
tmp = atan2(t_1, (-sin(phi1) * t_0));
} else {
tmp = atan2((t_1 * cos(phi2)), (-phi1 * t_0));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((lambda2 - lambda1))
t_1 = sin((lambda1 - lambda2))
if (phi2 <= 7400000000000.0d0) then
tmp = atan2(t_1, (-sin(phi1) * t_0))
else
tmp = atan2((t_1 * cos(phi2)), (-phi1 * t_0))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda2 - lambda1));
double t_1 = Math.sin((lambda1 - lambda2));
double tmp;
if (phi2 <= 7400000000000.0) {
tmp = Math.atan2(t_1, (-Math.sin(phi1) * t_0));
} else {
tmp = Math.atan2((t_1 * Math.cos(phi2)), (-phi1 * t_0));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda2 - lambda1)) t_1 = math.sin((lambda1 - lambda2)) tmp = 0 if phi2 <= 7400000000000.0: tmp = math.atan2(t_1, (-math.sin(phi1) * t_0)) else: tmp = math.atan2((t_1 * math.cos(phi2)), (-phi1 * t_0)) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda2 - lambda1)) t_1 = sin(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= 7400000000000.0) tmp = atan(t_1, Float64(Float64(-sin(phi1)) * t_0)); else tmp = atan(Float64(t_1 * cos(phi2)), Float64(Float64(-phi1) * t_0)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda2 - lambda1)); t_1 = sin((lambda1 - lambda2)); tmp = 0.0; if (phi2 <= 7400000000000.0) tmp = atan2(t_1, (-sin(phi1) * t_0)); else tmp = atan2((t_1 * cos(phi2)), (-phi1 * t_0)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 7400000000000.0], N[ArcTan[t$95$1 / N[((-N[Sin[phi1], $MachinePrecision]) * t$95$0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(t$95$1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[((-phi1) * t$95$0), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_2 - \lambda_1\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 7400000000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\left(-\sin \phi_1\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1 \cdot \cos \phi_2}{\left(-\phi_1\right) \cdot t\_0}\\
\end{array}
\end{array}
if phi2 < 7.4e12Initial program 80.2%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval70.0
Applied rewrites70.0%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6460.4
Applied rewrites60.4%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6458.4
Applied rewrites58.4%
if 7.4e12 < phi2 Initial program 80.5%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval60.2
Applied rewrites60.2%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6422.6
Applied rewrites22.6%
Taylor expanded in phi1 around 0
Applied rewrites19.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (- (sin phi1)))
(t_1 (atan2 (sin lambda1) (* t_0 (cos (- lambda2 lambda1))))))
(if (<= lambda1 -4.2e+49)
t_1
(if (<= lambda1 450000.0)
(atan2 (sin (- lambda1 lambda2)) (* (cos lambda2) t_0))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -sin(phi1);
double t_1 = atan2(sin(lambda1), (t_0 * cos((lambda2 - lambda1))));
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = t_1;
} else if (lambda1 <= 450000.0) {
tmp = atan2(sin((lambda1 - lambda2)), (cos(lambda2) * t_0));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -sin(phi1)
t_1 = atan2(sin(lambda1), (t_0 * cos((lambda2 - lambda1))))
if (lambda1 <= (-4.2d+49)) then
tmp = t_1
else if (lambda1 <= 450000.0d0) then
tmp = atan2(sin((lambda1 - lambda2)), (cos(lambda2) * t_0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -Math.sin(phi1);
double t_1 = Math.atan2(Math.sin(lambda1), (t_0 * Math.cos((lambda2 - lambda1))));
double tmp;
if (lambda1 <= -4.2e+49) {
tmp = t_1;
} else if (lambda1 <= 450000.0) {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (Math.cos(lambda2) * t_0));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = -math.sin(phi1) t_1 = math.atan2(math.sin(lambda1), (t_0 * math.cos((lambda2 - lambda1)))) tmp = 0 if lambda1 <= -4.2e+49: tmp = t_1 elif lambda1 <= 450000.0: tmp = math.atan2(math.sin((lambda1 - lambda2)), (math.cos(lambda2) * t_0)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(-sin(phi1)) t_1 = atan(sin(lambda1), Float64(t_0 * cos(Float64(lambda2 - lambda1)))) tmp = 0.0 if (lambda1 <= -4.2e+49) tmp = t_1; elseif (lambda1 <= 450000.0) tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(cos(lambda2) * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = -sin(phi1); t_1 = atan2(sin(lambda1), (t_0 * cos((lambda2 - lambda1)))); tmp = 0.0; if (lambda1 <= -4.2e+49) tmp = t_1; elseif (lambda1 <= 450000.0) tmp = atan2(sin((lambda1 - lambda2)), (cos(lambda2) * t_0)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = (-N[Sin[phi1], $MachinePrecision])}, Block[{t$95$1 = N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(t$95$0 * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -4.2e+49], t$95$1, If[LessEqual[lambda1, 450000.0], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[lambda2], $MachinePrecision] * t$95$0), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\sin \phi_1\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1}{t\_0 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -4.2 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 450000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -4.20000000000000022e49 or 4.5e5 < lambda1 Initial program 64.9%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval54.6
Applied rewrites54.6%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6436.9
Applied rewrites36.9%
Taylor expanded in lambda2 around 0
Applied rewrites37.9%
if -4.20000000000000022e49 < lambda1 < 4.5e5Initial program 94.6%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval79.5
Applied rewrites79.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6461.2
Applied rewrites61.2%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6455.9
Applied rewrites55.9%
Taylor expanded in lambda1 around 0
Applied rewrites55.9%
Final simplification47.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (* (- (sin phi1)) (cos (- lambda2 lambda1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (-sin(phi1) * cos((lambda2 - lambda1))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), (-sin(phi1) * cos((lambda2 - lambda1))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), (-Math.sin(phi1) * Math.cos((lambda2 - lambda1))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (-math.sin(phi1) * math.cos((lambda2 - lambda1))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(-sin(phi1)) * cos(Float64(lambda2 - lambda1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (-sin(phi1) * cos((lambda2 - lambda1)))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[((-N[Sin[phi1], $MachinePrecision]) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\left(-\sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}
\end{array}
Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval67.5
Applied rewrites67.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6450.9
Applied rewrites50.9%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6446.8
Applied rewrites46.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) (* (cos lambda1) (- (sin phi1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), (cos(lambda1) * -sin(phi1)));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin((lambda1 - lambda2)), (cos(lambda1) * -sin(phi1)))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), (Math.cos(lambda1) * -Math.sin(phi1)));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), (math.cos(lambda1) * -math.sin(phi1)))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), Float64(cos(lambda1) * Float64(-sin(phi1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), (cos(lambda1) * -sin(phi1))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[lambda1], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_1 \cdot \left(-\sin \phi_1\right)}
\end{array}
Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval67.5
Applied rewrites67.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6450.9
Applied rewrites50.9%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in lambda2 around 0
Applied rewrites41.6%
Final simplification41.6%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin lambda1) (* (- (sin phi1)) (cos (- lambda2 lambda1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin(lambda1), (-sin(phi1) * cos((lambda2 - lambda1))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2(sin(lambda1), (-sin(phi1) * cos((lambda2 - lambda1))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin(lambda1), (-Math.sin(phi1) * Math.cos((lambda2 - lambda1))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin(lambda1), (-math.sin(phi1) * math.cos((lambda2 - lambda1))))
function code(lambda1, lambda2, phi1, phi2) return atan(sin(lambda1), Float64(Float64(-sin(phi1)) * cos(Float64(lambda2 - lambda1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin(lambda1), (-sin(phi1) * cos((lambda2 - lambda1)))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[((-N[Sin[phi1], $MachinePrecision]) * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \lambda_1}{\left(-\sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}
\end{array}
Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
sin-cos-multN/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-sin.f64N/A
lower--.f64N/A
lower-*.f64N/A
metadata-eval67.5
Applied rewrites67.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.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
sub-negN/A
lower--.f6450.9
Applied rewrites50.9%
Taylor expanded in phi2 around 0
sub-negN/A
neg-mul-1N/A
lower-sin.f64N/A
neg-mul-1N/A
sub-negN/A
lower--.f6446.8
Applied rewrites46.8%
Taylor expanded in lambda2 around 0
Applied rewrites33.7%
herbie shell --seed 2024276
(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))))))