
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 32 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(+
(* (* (sin lambda1) (cos lambda2)) (cos phi2))
(* (cos phi2) (* (cos lambda1) (sin (- lambda2)))))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) * cos(phi2)) + (cos(phi2) * (cos(lambda1) * sin(-lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) * cos(phi2)) + Float64(cos(phi2) * Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2 + \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
distribute-rgt-inN/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(fma
(* (cos lambda1) (sin (- lambda2)))
(cos phi2)
(* (* (sin lambda1) (cos lambda2)) (cos phi2)))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(fma((cos(lambda1) * sin(-lambda2)), cos(phi2), ((sin(lambda1) * cos(lambda2)) * cos(phi2))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(fma(Float64(cos(lambda1) * sin(Float64(-lambda2))), cos(phi2), Float64(Float64(sin(lambda1) * cos(lambda2)) * cos(phi2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision] + N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\mathsf{fma}\left(\cos \lambda_1 \cdot \sin \left(-\lambda_2\right), \cos \phi_2, \left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(cos phi2)
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2)))))
(-
(* (cos phi1) (sin phi2))
(*
(* (cos phi2) (sin phi1))
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(atan2
(*
(cos phi2)
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))))
(fma
(cos phi1)
(sin phi2)
(*
(cos phi2)
(*
(fma (sin lambda1) (sin lambda2) (* (cos lambda2) (cos lambda1)))
(- (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), (cos(phi2) * (fma(sin(lambda1), sin(lambda2), (cos(lambda2) * cos(lambda1))) * -sin(phi1)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2)))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(fma(sin(lambda1), sin(lambda2), Float64(cos(lambda2) * cos(lambda1))) * Float64(-sin(phi1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(\mathsf{fma}\left(\sin \lambda_1, \sin \lambda_2, \cos \lambda_2 \cdot \cos \lambda_1\right) \cdot \left(-\sin \phi_1\right)\right)\right)}
\end{array}
Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda1) (sin (- lambda2))))
(t_1 (* (cos phi2) (fma (sin lambda1) (cos lambda2) t_0)))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (- (* (cos phi1) (sin phi2)) (* t_2 (cos (- lambda1 lambda2))))))
(if (<= phi2 -2.65e-5)
(atan2 t_1 t_3)
(if (<= phi2 5.5e-6)
(atan2
t_1
(-
(* phi2 (cos phi1))
(*
t_2
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1))))))
(atan2
(fma (* (sin lambda1) (cos lambda2)) (cos phi2) (* (cos phi2) t_0))
t_3)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda1) * sin(-lambda2);
double t_1 = cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0);
double t_2 = cos(phi2) * sin(phi1);
double t_3 = (cos(phi1) * sin(phi2)) - (t_2 * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= -2.65e-5) {
tmp = atan2(t_1, t_3);
} else if (phi2 <= 5.5e-6) {
tmp = atan2(t_1, ((phi2 * cos(phi1)) - (t_2 * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
} else {
tmp = atan2(fma((sin(lambda1) * cos(lambda2)), cos(phi2), (cos(phi2) * t_0)), t_3);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda1) * sin(Float64(-lambda2))) t_1 = Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0)) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_2 * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= -2.65e-5) tmp = atan(t_1, t_3); elseif (phi2 <= 5.5e-6) tmp = atan(t_1, Float64(Float64(phi2 * cos(phi1)) - Float64(t_2 * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))); else tmp = atan(fma(Float64(sin(lambda1) * cos(lambda2)), cos(phi2), Float64(cos(phi2) * t_0)), t_3); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2.65e-5], N[ArcTan[t$95$1 / t$95$3], $MachinePrecision], If[LessEqual[phi2, 5.5e-6], N[ArcTan[t$95$1 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$3], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, t\_0\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \phi_1 \cdot \sin \phi_2 - t\_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -2.65 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_3}\\
\mathbf{elif}\;\phi_2 \leq 5.5 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\phi_2 \cdot \cos \phi_1 - t\_2 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1 \cdot \cos \lambda_2, \cos \phi_2, \cos \phi_2 \cdot t\_0\right)}{t\_3}\\
\end{array}
\end{array}
if phi2 < -2.65e-5Initial program 77.5%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.8
Applied rewrites90.8%
if -2.65e-5 < phi2 < 5.4999999999999999e-6Initial program 84.6%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f6499.9
Applied rewrites99.9%
if 5.4999999999999999e-6 < phi2 Initial program 69.7%
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.5
Applied rewrites89.5%
Final simplification94.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda1) (sin (- lambda2))))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (- t_1 (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2)))))
(t_3 (* (cos phi2) (fma (sin lambda1) (cos lambda2) t_0))))
(if (<= phi2 -2e-8)
(atan2 t_3 t_2)
(if (<= phi2 4.5e-6)
(atan2
t_3
(-
t_1
(*
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1)))
(sin phi1))))
(atan2
(fma (* (sin lambda1) (cos lambda2)) (cos phi2) (* (cos phi2) t_0))
t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda1) * sin(-lambda2);
double t_1 = cos(phi1) * sin(phi2);
double t_2 = t_1 - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)));
double t_3 = cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0);
double tmp;
if (phi2 <= -2e-8) {
tmp = atan2(t_3, t_2);
} else if (phi2 <= 4.5e-6) {
tmp = atan2(t_3, (t_1 - (fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))) * sin(phi1))));
} else {
tmp = atan2(fma((sin(lambda1) * cos(lambda2)), cos(phi2), (cos(phi2) * t_0)), t_2);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda1) * sin(Float64(-lambda2))) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(t_1 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2)))) t_3 = Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0)) tmp = 0.0 if (phi2 <= -2e-8) tmp = atan(t_3, t_2); elseif (phi2 <= 4.5e-6) tmp = atan(t_3, Float64(t_1 - Float64(fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1))) * sin(phi1)))); else tmp = atan(fma(Float64(sin(lambda1) * cos(lambda2)), cos(phi2), Float64(cos(phi2) * t_0)), t_2); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2e-8], N[ArcTan[t$95$3 / t$95$2], $MachinePrecision], If[LessEqual[phi2, 4.5e-6], N[ArcTan[t$95$3 / N[(t$95$1 - 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]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := t\_1 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
t_3 := \cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, t\_0\right)\\
\mathbf{if}\;\phi_2 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_2}\\
\mathbf{elif}\;\phi_2 \leq 4.5 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{t\_1 - \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1 \cdot \cos \lambda_2, \cos \phi_2, \cos \phi_2 \cdot t\_0\right)}{t\_2}\\
\end{array}
\end{array}
if phi2 < -2e-8Initial program 77.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.9
Applied rewrites90.9%
if -2e-8 < phi2 < 4.50000000000000011e-6Initial program 84.5%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.0
Applied rewrites90.0%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
lower-sin.f6499.7
Applied rewrites99.7%
if 4.50000000000000011e-6 < phi2 Initial program 69.7%
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.5
Applied rewrites89.5%
Final simplification94.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda1) (sin (- lambda2))))
(t_1 (* (cos phi2) (fma (sin lambda1) (cos lambda2) t_0)))
(t_2 (* (cos phi2) (sin phi1)))
(t_3 (- (* (cos phi1) (sin phi2)) (* t_2 (cos (- lambda1 lambda2))))))
(if (<= phi2 -2.55e-10)
(atan2 t_1 t_3)
(if (<= phi2 2e-6)
(atan2
t_1
(-
(sin phi2)
(*
t_2
(fma (sin lambda2) (sin lambda1) (* (cos lambda2) (cos lambda1))))))
(atan2
(fma (* (sin lambda1) (cos lambda2)) (cos phi2) (* (cos phi2) t_0))
t_3)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda1) * sin(-lambda2);
double t_1 = cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0);
double t_2 = cos(phi2) * sin(phi1);
double t_3 = (cos(phi1) * sin(phi2)) - (t_2 * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= -2.55e-10) {
tmp = atan2(t_1, t_3);
} else if (phi2 <= 2e-6) {
tmp = atan2(t_1, (sin(phi2) - (t_2 * fma(sin(lambda2), sin(lambda1), (cos(lambda2) * cos(lambda1))))));
} else {
tmp = atan2(fma((sin(lambda1) * cos(lambda2)), cos(phi2), (cos(phi2) * t_0)), t_3);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda1) * sin(Float64(-lambda2))) t_1 = Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), t_0)) t_2 = Float64(cos(phi2) * sin(phi1)) t_3 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_2 * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= -2.55e-10) tmp = atan(t_1, t_3); elseif (phi2 <= 2e-6) tmp = atan(t_1, Float64(sin(phi2) - Float64(t_2 * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda2) * cos(lambda1)))))); else tmp = atan(fma(Float64(sin(lambda1) * cos(lambda2)), cos(phi2), Float64(cos(phi2) * t_0)), t_3); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2.55e-10], N[ArcTan[t$95$1 / t$95$3], $MachinePrecision], If[LessEqual[phi2, 2e-6], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] - N[(t$95$2 * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$3], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, t\_0\right)\\
t_2 := \cos \phi_2 \cdot \sin \phi_1\\
t_3 := \cos \phi_1 \cdot \sin \phi_2 - t\_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -2.55 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_3}\\
\mathbf{elif}\;\phi_2 \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\sin \phi_2 - t\_2 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1 \cdot \cos \lambda_2, \cos \phi_2, \cos \phi_2 \cdot t\_0\right)}{t\_3}\\
\end{array}
\end{array}
if phi2 < -2.54999999999999998e-10Initial program 77.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.9
Applied rewrites90.9%
if -2.54999999999999998e-10 < phi2 < 1.99999999999999991e-6Initial program 84.5%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.0
Applied rewrites90.0%
lift-cos.f64N/A
lift--.f64N/A
cos-diffN/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in phi1 around 0
lower-sin.f6499.2
Applied rewrites99.2%
if 1.99999999999999991e-6 < phi2 Initial program 69.7%
lift-*.f64N/A
*-commutativeN/A
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6489.5
Applied rewrites89.5%
Final simplification94.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2
(atan2
(*
(cos phi2)
(fma
(sin lambda1)
(cos lambda2)
(* (cos lambda1) (sin (- lambda2)))))
(- t_0 (* t_1 (cos lambda2))))))
(if (<= lambda2 -1.14e-10)
t_2
(if (<= lambda2 0.0215)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(- t_0 (* t_1 (fma lambda2 (sin lambda1) (cos lambda1)))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), (t_0 - (t_1 * cos(lambda2))));
double tmp;
if (lambda2 <= -1.14e-10) {
tmp = t_2;
} else if (lambda2 <= 0.0215) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (t_1 * fma(lambda2, sin(lambda1), cos(lambda1)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(t_0 - Float64(t_1 * cos(lambda2)))) tmp = 0.0 if (lambda2 <= -1.14e-10) tmp = t_2; elseif (lambda2 <= 0.0215) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(t_1 * fma(lambda2, sin(lambda1), cos(lambda1))))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -1.14e-10], t$95$2, If[LessEqual[lambda2, 0.0215], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[(lambda2 * N[Sin[lambda1], $MachinePrecision] + N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{t\_0 - t\_1 \cdot \cos \lambda_2}\\
\mathbf{if}\;\lambda_2 \leq -1.14 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_2 \leq 0.0215:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - t\_1 \cdot \mathsf{fma}\left(\lambda_2, \sin \lambda_1, \cos \lambda_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda2 < -1.1399999999999999e-10 or 0.021499999999999998 < lambda2 Initial program 60.6%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6482.0
Applied rewrites82.0%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6482.1
Applied rewrites82.1%
if -1.1399999999999999e-10 < lambda2 < 0.021499999999999998Initial program 99.2%
Taylor expanded in lambda2 around 0
+-commutativeN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f6499.3
Applied rewrites99.3%
Final simplification90.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2
(atan2
(*
(cos phi2)
(fma
(sin lambda1)
(cos lambda2)
(* (cos lambda1) (sin (- lambda2)))))
(- t_0 (* t_1 (cos lambda1))))))
(if (<= lambda1 -7.8e-7)
t_2
(if (<= lambda1 0.135)
(atan2
(* (cos phi2) (- (* lambda1 (cos lambda2)) (sin lambda2)))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), (t_0 - (t_1 * cos(lambda1))));
double tmp;
if (lambda1 <= -7.8e-7) {
tmp = t_2;
} else if (lambda1 <= 0.135) {
tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(t_0 - Float64(t_1 * cos(lambda1)))) tmp = 0.0 if (lambda1 <= -7.8e-7) tmp = t_2; elseif (lambda1 <= 0.135) tmp = atan(Float64(cos(phi2) * Float64(Float64(lambda1 * cos(lambda2)) - sin(lambda2))), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -7.8e-7], t$95$2, If[LessEqual[lambda1, 0.135], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(lambda1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{t\_0 - t\_1 \cdot \cos \lambda_1}\\
\mathbf{if}\;\lambda_1 \leq -7.8 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_1 \leq 0.135:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2\right)}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda1 < -7.80000000000000049e-7 or 0.13500000000000001 < lambda1 Initial program 60.0%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6481.6
Applied rewrites81.6%
Taylor expanded in lambda2 around 0
lower-cos.f6481.5
Applied rewrites81.5%
if -7.80000000000000049e-7 < lambda1 < 0.13500000000000001Initial program 98.9%
Taylor expanded in lambda1 around 0
+-commutativeN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-sin.f6499.2
Applied rewrites99.2%
Final simplification90.1%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2))))) (- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos((lambda1 - lambda2)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(Float64(lambda1 - lambda2))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 78.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.1
Applied rewrites90.1%
Final simplification90.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (- (sin phi1)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -1250000000.0)
(atan2 t_2 (fma (sin phi2) (cos phi1) (* t_0 (* (cos phi2) t_1))))
(if (<= phi1 4.1e-22)
(atan2
(*
(cos phi2)
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2)))))
(- (* (cos phi1) (sin phi2)) (* t_0 (sin phi1))))
(atan2 t_2 (fma (cos phi1) (sin phi2) (* (cos phi2) (* t_0 t_1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = -sin(phi1);
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -1250000000.0) {
tmp = atan2(t_2, fma(sin(phi2), cos(phi1), (t_0 * (cos(phi2) * t_1))));
} else if (phi1 <= 4.1e-22) {
tmp = atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), ((cos(phi1) * sin(phi2)) - (t_0 * sin(phi1))));
} else {
tmp = atan2(t_2, fma(cos(phi1), sin(phi2), (cos(phi2) * (t_0 * t_1))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(-sin(phi1)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -1250000000.0) tmp = atan(t_2, fma(sin(phi2), cos(phi1), Float64(t_0 * Float64(cos(phi2) * t_1)))); elseif (phi1 <= 4.1e-22) tmp = atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * sin(phi1)))); else tmp = atan(t_2, fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(t_0 * t_1)))); 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[Sin[phi1], $MachinePrecision])}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -1250000000.0], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 4.1e-22], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := -\sin \phi_1\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -1250000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, t\_0 \cdot \left(\cos \phi_2 \cdot t\_1\right)\right)}\\
\mathbf{elif}\;\phi_1 \leq 4.1 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(t\_0 \cdot t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -1.25e9Initial program 77.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites53.5%
Applied rewrites77.3%
if -1.25e9 < phi1 < 4.0999999999999999e-22Initial program 78.1%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Taylor expanded in phi2 around 0
lower-sin.f6498.3
Applied rewrites98.3%
if 4.0999999999999999e-22 < phi1 Initial program 81.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.1
Applied rewrites81.1%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f64N/A
lower-neg.f64N/A
lower-cos.f6481.1
Applied rewrites81.1%
Final simplification88.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (- (sin phi1)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= phi1 -1250000000.0)
(atan2 t_2 (fma (sin phi2) (cos phi1) (* t_0 (* (cos phi2) t_1))))
(if (<= phi1 4.1e-22)
(atan2
(*
(cos phi2)
(fma (sin lambda1) (cos lambda2) (* (cos lambda1) (sin (- lambda2)))))
(- (sin phi2) (* (* (cos phi2) (sin phi1)) (cos lambda1))))
(atan2 t_2 (fma (cos phi1) (sin phi2) (* (cos phi2) (* t_0 t_1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = -sin(phi1);
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (phi1 <= -1250000000.0) {
tmp = atan2(t_2, fma(sin(phi2), cos(phi1), (t_0 * (cos(phi2) * t_1))));
} else if (phi1 <= 4.1e-22) {
tmp = atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (cos(lambda1) * sin(-lambda2)))), (sin(phi2) - ((cos(phi2) * sin(phi1)) * cos(lambda1))));
} else {
tmp = atan2(t_2, fma(cos(phi1), sin(phi2), (cos(phi2) * (t_0 * t_1))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(-sin(phi1)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (phi1 <= -1250000000.0) tmp = atan(t_2, fma(sin(phi2), cos(phi1), Float64(t_0 * Float64(cos(phi2) * t_1)))); elseif (phi1 <= 4.1e-22) tmp = atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(cos(lambda1) * sin(Float64(-lambda2))))), Float64(sin(phi2) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(lambda1)))); else tmp = atan(t_2, fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(t_0 * t_1)))); 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[Sin[phi1], $MachinePrecision])}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -1250000000.0], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 4.1e-22], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := -\sin \phi_1\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq -1250000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, t\_0 \cdot \left(\cos \phi_2 \cdot t\_1\right)\right)}\\
\mathbf{elif}\;\phi_1 \leq 4.1 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \sin \left(-\lambda_2\right)\right)}{\sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \lambda_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(t\_0 \cdot t\_1\right)\right)}\\
\end{array}
\end{array}
if phi1 < -1.25e9Initial program 77.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites53.5%
Applied rewrites77.3%
if -1.25e9 < phi1 < 4.0999999999999999e-22Initial program 78.1%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Taylor expanded in lambda2 around 0
lower-cos.f6497.8
Applied rewrites97.8%
Taylor expanded in phi1 around 0
lower-sin.f6497.8
Applied rewrites97.8%
if 4.0999999999999999e-22 < phi1 Initial program 81.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.1
Applied rewrites81.1%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f64N/A
lower-neg.f64N/A
lower-cos.f6481.1
Applied rewrites81.1%
Final simplification88.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= lambda2 -1.9)
(atan2 t_2 (- t_0 (* t_1 (cos lambda2))))
(if (<= lambda2 0.125)
(atan2 t_2 (- t_0 (* t_1 (cos lambda1))))
(atan2
(* (cos phi2) (sin (- lambda2)))
(- t_0 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -1.9) {
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2))));
} else if (lambda2 <= 0.125) {
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1))));
} else {
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
t_2 = cos(phi2) * sin((lambda1 - lambda2))
if (lambda2 <= (-1.9d0)) then
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2))))
else if (lambda2 <= 0.125d0) then
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1))))
else
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -1.9) {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.cos(lambda2))));
} else if (lambda2 <= 0.125) {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.cos(lambda1))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(-lambda2)), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if lambda2 <= -1.9: tmp = math.atan2(t_2, (t_0 - (t_1 * math.cos(lambda2)))) elif lambda2 <= 0.125: tmp = math.atan2(t_2, (t_0 - (t_1 * math.cos(lambda1)))) else: tmp = math.atan2((math.cos(phi2) * math.sin(-lambda2)), (t_0 - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2)))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (lambda2 <= -1.9) tmp = atan(t_2, Float64(t_0 - Float64(t_1 * cos(lambda2)))); elseif (lambda2 <= 0.125) tmp = atan(t_2, Float64(t_0 - Float64(t_1 * cos(lambda1)))); else tmp = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); t_2 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (lambda2 <= -1.9) tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2)))); elseif (lambda2 <= 0.125) tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1)))); else tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2)))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -1.9], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 0.125], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\lambda_2 \leq -1.9:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \cos \lambda_2}\\
\mathbf{elif}\;\lambda_2 \leq 0.125:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \cos \lambda_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\end{array}
\end{array}
if lambda2 < -1.8999999999999999Initial program 55.3%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6455.4
Applied rewrites55.4%
if -1.8999999999999999 < lambda2 < 0.125Initial program 98.1%
Taylor expanded in lambda2 around 0
lower-cos.f6498.1
Applied rewrites98.1%
if 0.125 < lambda2 Initial program 64.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
Taylor expanded in lambda1 around 0
neg-mul-1N/A
lower-neg.f6467.4
Applied rewrites67.4%
Final simplification79.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin phi1)))
(t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= lambda2 -1.9)
(atan2 t_2 (- t_0 (* t_1 (cos lambda2))))
(if (<= lambda2 0.125)
(atan2 t_2 (- t_0 (* t_1 (cos lambda1))))
(atan2
(* (cos phi2) (sin (- lambda2)))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin(phi1);
double t_2 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -1.9) {
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2))));
} else if (lambda2 <= 0.125) {
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1))));
} else {
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin(phi1)
t_2 = cos(phi2) * sin((lambda1 - lambda2))
if (lambda2 <= (-1.9d0)) then
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2))))
else if (lambda2 <= 0.125d0) then
tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1))))
else
tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin(phi1);
double t_2 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (lambda2 <= -1.9) {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.cos(lambda2))));
} else if (lambda2 <= 0.125) {
tmp = Math.atan2(t_2, (t_0 - (t_1 * Math.cos(lambda1))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(-lambda2)), (t_0 - (t_1 * Math.cos((lambda1 - lambda2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin(phi1) t_2 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if lambda2 <= -1.9: tmp = math.atan2(t_2, (t_0 - (t_1 * math.cos(lambda2)))) elif lambda2 <= 0.125: tmp = math.atan2(t_2, (t_0 - (t_1 * math.cos(lambda1)))) else: tmp = math.atan2((math.cos(phi2) * math.sin(-lambda2)), (t_0 - (t_1 * math.cos((lambda1 - lambda2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(phi1)) t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (lambda2 <= -1.9) tmp = atan(t_2, Float64(t_0 - Float64(t_1 * cos(lambda2)))); elseif (lambda2 <= 0.125) tmp = atan(t_2, Float64(t_0 - Float64(t_1 * cos(lambda1)))); else tmp = atan(Float64(cos(phi2) * sin(Float64(-lambda2))), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin(phi1); t_2 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (lambda2 <= -1.9) tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda2)))); elseif (lambda2 <= 0.125) tmp = atan2(t_2, (t_0 - (t_1 * cos(lambda1)))); else tmp = atan2((cos(phi2) * sin(-lambda2)), (t_0 - (t_1 * cos((lambda1 - lambda2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -1.9], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 0.125], N[ArcTan[t$95$2 / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[(-lambda2)], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \phi_1\\
t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\lambda_2 \leq -1.9:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \cos \lambda_2}\\
\mathbf{elif}\;\lambda_2 \leq 0.125:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - t\_1 \cdot \cos \lambda_1}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(-\lambda_2\right)}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\end{array}
\end{array}
if lambda2 < -1.8999999999999999Initial program 55.3%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6455.4
Applied rewrites55.4%
if -1.8999999999999999 < lambda2 < 0.125Initial program 98.1%
Taylor expanded in lambda2 around 0
lower-cos.f6498.1
Applied rewrites98.1%
if 0.125 < lambda2 Initial program 64.7%
Taylor expanded in lambda1 around 0
neg-mul-1N/A
lower-neg.f6467.4
Applied rewrites67.4%
Final simplification79.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
(if (<= lambda1 -6.2e-5)
(atan2 t_1 (- t_0 (* (cos phi2) (* (sin phi1) (cos lambda1)))))
(if (<= lambda1 190000000.0)
(atan2 t_1 (- t_0 (* (cos phi2) (* (sin phi1) (cos lambda2)))))
(atan2
(* (cos phi2) (sin lambda1))
(- t_0 (* (* (cos phi2) (sin phi1)) (cos lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = cos(phi2) * sin((lambda1 - lambda2));
double tmp;
if (lambda1 <= -6.2e-5) {
tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda1)))));
} else if (lambda1 <= 190000000.0) {
tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda2)))));
} else {
tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos(lambda1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = cos(phi2) * sin((lambda1 - lambda2))
if (lambda1 <= (-6.2d-5)) then
tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda1)))))
else if (lambda1 <= 190000000.0d0) then
tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda2)))))
else
tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos(lambda1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
double tmp;
if (lambda1 <= -6.2e-5) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos(lambda1)))));
} else if (lambda1 <= 190000000.0) {
tmp = Math.atan2(t_1, (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos(lambda2)))));
} else {
tmp = Math.atan2((Math.cos(phi2) * Math.sin(lambda1)), (t_0 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos(lambda1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2)) tmp = 0 if lambda1 <= -6.2e-5: tmp = math.atan2(t_1, (t_0 - (math.cos(phi2) * (math.sin(phi1) * math.cos(lambda1))))) elif lambda1 <= 190000000.0: tmp = math.atan2(t_1, (t_0 - (math.cos(phi2) * (math.sin(phi1) * math.cos(lambda2))))) else: tmp = math.atan2((math.cos(phi2) * math.sin(lambda1)), (t_0 - ((math.cos(phi2) * math.sin(phi1)) * math.cos(lambda1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) tmp = 0.0 if (lambda1 <= -6.2e-5) tmp = atan(t_1, Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * cos(lambda1))))); elseif (lambda1 <= 190000000.0) tmp = atan(t_1, Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * cos(lambda2))))); else tmp = atan(Float64(cos(phi2) * sin(lambda1)), Float64(t_0 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(lambda1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = cos(phi2) * sin((lambda1 - lambda2)); tmp = 0.0; if (lambda1 <= -6.2e-5) tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda1))))); elseif (lambda1 <= 190000000.0) tmp = atan2(t_1, (t_0 - (cos(phi2) * (sin(phi1) * cos(lambda2))))); else tmp = atan2((cos(phi2) * sin(lambda1)), (t_0 - ((cos(phi2) * sin(phi1)) * cos(lambda1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -6.2e-5], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 190000000.0], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\lambda_1 \leq -6.2 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \lambda_1\right)}\\
\mathbf{elif}\;\lambda_1 \leq 190000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{t\_0 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \lambda_1}\\
\end{array}
\end{array}
if lambda1 < -6.20000000000000027e-5Initial program 60.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
Taylor expanded in lambda2 around 0
lower-cos.f6482.8
Applied rewrites82.8%
Applied rewrites60.8%
if -6.20000000000000027e-5 < lambda1 < 1.9e8Initial program 98.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.2
Applied rewrites98.2%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6498.2
Applied rewrites98.2%
if 1.9e8 < lambda1 Initial program 59.4%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6480.9
Applied rewrites80.9%
Taylor expanded in lambda2 around 0
lower-cos.f6480.7
Applied rewrites80.7%
Taylor expanded in lambda2 around 0
lower-sin.f6460.8
Applied rewrites60.8%
Final simplification79.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(* (cos phi1) (sin phi2))
(* (cos phi2) (* (sin phi1) (cos lambda1)))))))
(if (<= phi2 -2.35e-8)
t_0
(if (<= phi2 1.05e-5)
(atan2
(fma (sin (- lambda2)) (cos lambda1) (* (sin lambda1) (cos lambda2)))
(- (sin phi2) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos(lambda1)))));
double tmp;
if (phi2 <= -2.35e-8) {
tmp = t_0;
} else if (phi2 <= 1.05e-5) {
tmp = atan2(fma(sin(-lambda2), cos(lambda1), (sin(lambda1) * cos(lambda2))), (sin(phi2) - (cos((lambda1 - lambda2)) * sin(phi1))));
} else {
tmp = t_0;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * cos(lambda1))))) tmp = 0.0 if (phi2 <= -2.35e-8) tmp = t_0; elseif (phi2 <= 1.05e-5) tmp = atan(fma(sin(Float64(-lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))), Float64(sin(phi2) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_0; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -2.35e-8], t$95$0, If[LessEqual[phi2, 1.05e-5], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \lambda_1\right)}\\
\mathbf{if}\;\phi_2 \leq -2.35 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \left(-\lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)}{\sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -2.3499999999999999e-8 or 1.04999999999999994e-5 < phi2 Initial program 73.8%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6490.2
Applied rewrites90.2%
Taylor expanded in lambda2 around 0
lower-cos.f6482.1
Applied rewrites82.1%
Applied rewrites65.9%
if -2.3499999999999999e-8 < phi2 < 1.04999999999999994e-5Initial program 84.6%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6484.4
Applied rewrites84.4%
Taylor expanded in phi2 around 0
lower-sin.f6484.6
Applied rewrites84.6%
Taylor expanded in phi1 around 0
lower-sin.f6484.1
Applied rewrites84.1%
Applied rewrites89.6%
Final simplification77.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin lambda1))) (t_1 (* (cos phi1) (sin phi2))))
(if (<= lambda1 -0.00305)
(atan2
t_0
(- t_1 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
(if (<= lambda1 1.05e+53)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(sin phi2)
(/
(*
(sin phi1)
(+
(cos (+ phi2 (- lambda1 lambda2)))
(cos (+ lambda2 (- phi2 lambda1)))))
2.0)))
(atan2 t_0 (- t_1 (* (* (cos phi2) (sin phi1)) (cos lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(lambda1);
double t_1 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -0.00305) {
tmp = atan2(t_0, (t_1 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
} else if (lambda1 <= 1.05e+53) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = atan2(t_0, (t_1 - ((cos(phi2) * sin(phi1)) * cos(lambda1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(phi2) * sin(lambda1)
t_1 = cos(phi1) * sin(phi2)
if (lambda1 <= (-0.00305d0)) then
tmp = atan2(t_0, (t_1 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))))
else if (lambda1 <= 1.05d+53) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0d0)))
else
tmp = atan2(t_0, (t_1 - ((cos(phi2) * sin(phi1)) * cos(lambda1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi2) * Math.sin(lambda1);
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -0.00305) {
tmp = Math.atan2(t_0, (t_1 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
} else if (lambda1 <= 1.05e+53) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(phi2) - ((Math.sin(phi1) * (Math.cos((phi2 + (lambda1 - lambda2))) + Math.cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = Math.atan2(t_0, (t_1 - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos(lambda1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin(lambda1) t_1 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -0.00305: tmp = math.atan2(t_0, (t_1 - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2)))))) elif lambda1 <= 1.05e+53: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.sin(phi2) - ((math.sin(phi1) * (math.cos((phi2 + (lambda1 - lambda2))) + math.cos((lambda2 + (phi2 - lambda1))))) / 2.0))) else: tmp = math.atan2(t_0, (t_1 - ((math.cos(phi2) * math.sin(phi1)) * math.cos(lambda1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(lambda1)) t_1 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -0.00305) tmp = atan(t_0, Float64(t_1 - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))); elseif (lambda1 <= 1.05e+53) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(Float64(sin(phi1) * Float64(cos(Float64(phi2 + Float64(lambda1 - lambda2))) + cos(Float64(lambda2 + Float64(phi2 - lambda1))))) / 2.0))); else tmp = atan(t_0, Float64(t_1 - Float64(Float64(cos(phi2) * sin(phi1)) * cos(lambda1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin(lambda1); t_1 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -0.00305) tmp = atan2(t_0, (t_1 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2)))))); elseif (lambda1 <= 1.05e+53) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0))); else tmp = atan2(t_0, (t_1 - ((cos(phi2) * sin(phi1)) * cos(lambda1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -0.00305], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 1.05e+53], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[N[(phi2 + N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(lambda2 + N[(phi2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \lambda_1\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.00305:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\mathbf{elif}\;\lambda_1 \leq 1.05 \cdot 10^{+53}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \frac{\sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \lambda_1}\\
\end{array}
\end{array}
if lambda1 < -0.00305000000000000019Initial program 60.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in lambda2 around 0
lower-sin.f6459.2
Applied rewrites59.2%
if -0.00305000000000000019 < lambda1 < 1.0500000000000001e53Initial program 94.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites86.2%
Taylor expanded in phi1 around 0
lower-sin.f6483.4
Applied rewrites83.4%
if 1.0500000000000001e53 < lambda1 Initial program 62.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6481.8
Applied rewrites81.8%
Taylor expanded in lambda2 around 0
lower-cos.f6481.7
Applied rewrites81.7%
Taylor expanded in lambda2 around 0
lower-sin.f6464.3
Applied rewrites64.3%
Final simplification73.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin phi1)))
(t_1 (* (cos phi2) (sin lambda1)))
(t_2 (* (cos phi1) (sin phi2))))
(if (<= lambda1 -0.00305)
(atan2 t_1 (- t_2 (* t_0 (cos (- lambda1 lambda2)))))
(if (<= lambda1 1.05e+53)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(sin phi2)
(/
(*
(sin phi1)
(+
(cos (+ phi2 (- lambda1 lambda2)))
(cos (+ lambda2 (- phi2 lambda1)))))
2.0)))
(atan2 t_1 (- t_2 (* t_0 (cos lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin(phi1);
double t_1 = cos(phi2) * sin(lambda1);
double t_2 = cos(phi1) * sin(phi2);
double tmp;
if (lambda1 <= -0.00305) {
tmp = atan2(t_1, (t_2 - (t_0 * cos((lambda1 - lambda2)))));
} else if (lambda1 <= 1.05e+53) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = atan2(t_1, (t_2 - (t_0 * cos(lambda1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos(phi2) * sin(phi1)
t_1 = cos(phi2) * sin(lambda1)
t_2 = cos(phi1) * sin(phi2)
if (lambda1 <= (-0.00305d0)) then
tmp = atan2(t_1, (t_2 - (t_0 * cos((lambda1 - lambda2)))))
else if (lambda1 <= 1.05d+53) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0d0)))
else
tmp = atan2(t_1, (t_2 - (t_0 * cos(lambda1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi2) * Math.sin(phi1);
double t_1 = Math.cos(phi2) * Math.sin(lambda1);
double t_2 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda1 <= -0.00305) {
tmp = Math.atan2(t_1, (t_2 - (t_0 * Math.cos((lambda1 - lambda2)))));
} else if (lambda1 <= 1.05e+53) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(phi2) - ((Math.sin(phi1) * (Math.cos((phi2 + (lambda1 - lambda2))) + Math.cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = Math.atan2(t_1, (t_2 - (t_0 * Math.cos(lambda1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi2) * math.sin(phi1) t_1 = math.cos(phi2) * math.sin(lambda1) t_2 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda1 <= -0.00305: tmp = math.atan2(t_1, (t_2 - (t_0 * math.cos((lambda1 - lambda2))))) elif lambda1 <= 1.05e+53: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.sin(phi2) - ((math.sin(phi1) * (math.cos((phi2 + (lambda1 - lambda2))) + math.cos((lambda2 + (phi2 - lambda1))))) / 2.0))) else: tmp = math.atan2(t_1, (t_2 - (t_0 * math.cos(lambda1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(phi1)) t_1 = Float64(cos(phi2) * sin(lambda1)) t_2 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda1 <= -0.00305) tmp = atan(t_1, Float64(t_2 - Float64(t_0 * cos(Float64(lambda1 - lambda2))))); elseif (lambda1 <= 1.05e+53) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(Float64(sin(phi1) * Float64(cos(Float64(phi2 + Float64(lambda1 - lambda2))) + cos(Float64(lambda2 + Float64(phi2 - lambda1))))) / 2.0))); else tmp = atan(t_1, Float64(t_2 - Float64(t_0 * cos(lambda1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi2) * sin(phi1); t_1 = cos(phi2) * sin(lambda1); t_2 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda1 <= -0.00305) tmp = atan2(t_1, (t_2 - (t_0 * cos((lambda1 - lambda2))))); elseif (lambda1 <= 1.05e+53) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0))); else tmp = atan2(t_1, (t_2 - (t_0 * cos(lambda1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -0.00305], N[ArcTan[t$95$1 / N[(t$95$2 - N[(t$95$0 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 1.05e+53], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[N[(phi2 + N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(lambda2 + N[(phi2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$2 - N[(t$95$0 * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \phi_1\\
t_1 := \cos \phi_2 \cdot \sin \lambda_1\\
t_2 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_1 \leq -0.00305:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - t\_0 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{elif}\;\lambda_1 \leq 1.05 \cdot 10^{+53}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \frac{\sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_2 - t\_0 \cdot \cos \lambda_1}\\
\end{array}
\end{array}
if lambda1 < -0.00305000000000000019Initial program 60.8%
Taylor expanded in lambda2 around 0
lower-sin.f6459.2
Applied rewrites59.2%
if -0.00305000000000000019 < lambda1 < 1.0500000000000001e53Initial program 94.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites86.2%
Taylor expanded in phi1 around 0
lower-sin.f6483.4
Applied rewrites83.4%
if 1.0500000000000001e53 < lambda1 Initial program 62.3%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6481.8
Applied rewrites81.8%
Taylor expanded in lambda2 around 0
lower-cos.f6481.7
Applied rewrites81.7%
Taylor expanded in lambda2 around 0
lower-sin.f6464.3
Applied rewrites64.3%
Final simplification73.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (cos phi2) (sin lambda1))
(-
(* (cos phi1) (sin phi2))
(* (* (cos phi2) (sin phi1)) (cos lambda1))))))
(if (<= lambda1 -0.00305)
t_0
(if (<= lambda1 1.05e+53)
(atan2
(* (cos phi2) (sin (- lambda1 lambda2)))
(-
(sin phi2)
(/
(*
(sin phi1)
(+
(cos (+ phi2 (- lambda1 lambda2)))
(cos (+ lambda2 (- phi2 lambda1)))))
2.0)))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((cos(phi2) * sin(lambda1)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos(lambda1))));
double tmp;
if (lambda1 <= -0.00305) {
tmp = t_0;
} else if (lambda1 <= 1.05e+53) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((cos(phi2) * sin(lambda1)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos(lambda1))))
if (lambda1 <= (-0.00305d0)) then
tmp = t_0
else if (lambda1 <= 1.05d+53) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.cos(phi2) * Math.sin(lambda1)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(phi2) * Math.sin(phi1)) * Math.cos(lambda1))));
double tmp;
if (lambda1 <= -0.00305) {
tmp = t_0;
} else if (lambda1 <= 1.05e+53) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.sin(phi2) - ((Math.sin(phi1) * (Math.cos((phi2 + (lambda1 - lambda2))) + Math.cos((lambda2 + (phi2 - lambda1))))) / 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.cos(phi2) * math.sin(lambda1)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(phi2) * math.sin(phi1)) * math.cos(lambda1)))) tmp = 0 if lambda1 <= -0.00305: tmp = t_0 elif lambda1 <= 1.05e+53: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.sin(phi2) - ((math.sin(phi1) * (math.cos((phi2 + (lambda1 - lambda2))) + math.cos((lambda2 + (phi2 - lambda1))))) / 2.0))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(cos(phi2) * sin(lambda1)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * cos(lambda1)))) tmp = 0.0 if (lambda1 <= -0.00305) tmp = t_0; elseif (lambda1 <= 1.05e+53) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(sin(phi2) - Float64(Float64(sin(phi1) * Float64(cos(Float64(phi2 + Float64(lambda1 - lambda2))) + cos(Float64(lambda2 + Float64(phi2 - lambda1))))) / 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((cos(phi2) * sin(lambda1)), ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * cos(lambda1)))); tmp = 0.0; if (lambda1 <= -0.00305) tmp = t_0; elseif (lambda1 <= 1.05e+53) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (sin(phi2) - ((sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1))))) / 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -0.00305], t$95$0, If[LessEqual[lambda1, 1.05e+53], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[N[(phi2 + N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(lambda2 + N[(phi2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \lambda_1}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \cos \lambda_1}\\
\mathbf{if}\;\lambda_1 \leq -0.00305:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.05 \cdot 10^{+53}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2 - \frac{\sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -0.00305000000000000019 or 1.0500000000000001e53 < lambda1 Initial program 61.5%
lift-sin.f64N/A
lift--.f64N/A
sin-diffN/A
sub-negN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
distribute-rgt-neg-inN/A
sin-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-neg.f6482.4
Applied rewrites82.4%
Taylor expanded in lambda2 around 0
lower-cos.f6482.3
Applied rewrites82.3%
Taylor expanded in lambda2 around 0
lower-sin.f6461.4
Applied rewrites61.4%
if -0.00305000000000000019 < lambda1 < 1.0500000000000001e53Initial program 94.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites86.2%
Taylor expanded in phi1 around 0
lower-sin.f6483.4
Applied rewrites83.4%
Final simplification73.1%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (fma (sin phi2) (cos phi1) (* (cos (- lambda1 lambda2)) (* (cos phi2) (- (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(sin(phi2), cos(phi1), (cos((lambda1 - lambda2)) * (cos(phi2) * -sin(phi1)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(sin(phi2), cos(phi1), Float64(cos(Float64(lambda1 - lambda2)) * Float64(cos(phi2) * Float64(-sin(phi1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\cos \phi_2 \cdot \left(-\sin \phi_1\right)\right)\right)}
\end{array}
Initial program 78.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites68.9%
Applied rewrites78.9%
Final simplification78.9%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (fma (cos phi1) (sin phi2) (* (cos phi2) (* (cos (- lambda1 lambda2)) (- (sin phi1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), fma(cos(phi1), sin(phi2), (cos(phi2) * (cos((lambda1 - lambda2)) * -sin(phi1)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), fma(cos(phi1), sin(phi2), Float64(cos(phi2) * Float64(cos(Float64(lambda1 - lambda2)) * Float64(-sin(phi1)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\mathsf{fma}\left(\cos \phi_1, \sin \phi_2, \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(-\sin \phi_1\right)\right)\right)}
\end{array}
Initial program 78.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.8
Applied rewrites78.8%
Taylor expanded in lambda1 around 0
lower-atan2.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower--.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-sin.f64N/A
lower-neg.f64N/A
lower-cos.f6478.8
Applied rewrites78.8%
Final simplification78.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos (- lambda1 lambda2)) (sin phi1)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- (* (cos phi1) (sin phi2)) t_0))))
(if (<= lambda1 -0.00185)
t_1
(if (<= lambda1 0.155)
(atan2
(* (cos phi2) (- (* lambda1 (cos lambda2)) (sin lambda2)))
(- (sin phi2) t_0))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2)) * sin(phi1);
double t_1 = atan2((sin(lambda1) * cos(phi2)), ((cos(phi1) * sin(phi2)) - t_0));
double tmp;
if (lambda1 <= -0.00185) {
tmp = t_1;
} else if (lambda1 <= 0.155) {
tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (sin(phi2) - 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 = cos((lambda1 - lambda2)) * sin(phi1)
t_1 = atan2((sin(lambda1) * cos(phi2)), ((cos(phi1) * sin(phi2)) - t_0))
if (lambda1 <= (-0.00185d0)) then
tmp = t_1
else if (lambda1 <= 0.155d0) then
tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (sin(phi2) - 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.cos((lambda1 - lambda2)) * Math.sin(phi1);
double t_1 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - t_0));
double tmp;
if (lambda1 <= -0.00185) {
tmp = t_1;
} else if (lambda1 <= 0.155) {
tmp = Math.atan2((Math.cos(phi2) * ((lambda1 * Math.cos(lambda2)) - Math.sin(lambda2))), (Math.sin(phi2) - t_0));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) * math.sin(phi1) t_1 = math.atan2((math.sin(lambda1) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - t_0)) tmp = 0 if lambda1 <= -0.00185: tmp = t_1 elif lambda1 <= 0.155: tmp = math.atan2((math.cos(phi2) * ((lambda1 * math.cos(lambda2)) - math.sin(lambda2))), (math.sin(phi2) - t_0)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - t_0)) tmp = 0.0 if (lambda1 <= -0.00185) tmp = t_1; elseif (lambda1 <= 0.155) tmp = atan(Float64(cos(phi2) * Float64(Float64(lambda1 * cos(lambda2)) - sin(lambda2))), Float64(sin(phi2) - t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)) * sin(phi1); t_1 = atan2((sin(lambda1) * cos(phi2)), ((cos(phi1) * sin(phi2)) - t_0)); tmp = 0.0; if (lambda1 <= -0.00185) tmp = t_1; elseif (lambda1 <= 0.155) tmp = atan2((cos(phi2) * ((lambda1 * cos(lambda2)) - sin(lambda2))), (sin(phi2) - t_0)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -0.00185], t$95$1, If[LessEqual[lambda1, 0.155], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(lambda1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - t\_0}\\
\mathbf{if}\;\lambda_1 \leq -0.00185:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 0.155:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2\right)}{\sin \phi_2 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -0.0018500000000000001 or 0.154999999999999999 < lambda1 Initial program 60.0%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6435.3
Applied rewrites35.3%
Taylor expanded in phi2 around 0
lower-sin.f6435.3
Applied rewrites35.3%
Taylor expanded in lambda2 around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6448.9
Applied rewrites48.9%
if -0.0018500000000000001 < lambda1 < 0.154999999999999999Initial program 98.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6461.2
Applied rewrites61.2%
Taylor expanded in phi2 around 0
lower-sin.f6460.6
Applied rewrites60.6%
Taylor expanded in phi1 around 0
lower-sin.f6460.1
Applied rewrites60.1%
Taylor expanded in lambda1 around 0
+-commutativeN/A
*-commutativeN/A
cos-negN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-cos.f64N/A
+-commutativeN/A
sin-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6486.2
Applied rewrites86.2%
Final simplification67.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (sin (- lambda1 lambda2)))
(t_2 (* (cos phi2) t_1)))
(if (<= phi1 -2.8e-6)
(atan2
t_1
(- (* (cos phi1) (sin phi2)) (* (* (cos phi2) (sin phi1)) t_0)))
(if (<= phi1 0.0115)
(atan2
t_2
(fma
(* phi1 -0.5)
(+
(cos (+ lambda2 (- phi2 lambda1)))
(cos (- (+ lambda1 phi2) lambda2)))
(sin phi2)))
(atan2 t_2 (* (* (sin phi1) -0.5) (+ t_0 t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2));
double t_2 = cos(phi2) * t_1;
double tmp;
if (phi1 <= -2.8e-6) {
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - ((cos(phi2) * sin(phi1)) * t_0)));
} else if (phi1 <= 0.0115) {
tmp = atan2(t_2, fma((phi1 * -0.5), (cos((lambda2 + (phi2 - lambda1))) + cos(((lambda1 + phi2) - lambda2))), sin(phi2)));
} else {
tmp = atan2(t_2, ((sin(phi1) * -0.5) * (t_0 + t_0)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = sin(Float64(lambda1 - lambda2)) t_2 = Float64(cos(phi2) * t_1) tmp = 0.0 if (phi1 <= -2.8e-6) tmp = atan(t_1, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(phi2) * sin(phi1)) * t_0))); elseif (phi1 <= 0.0115) tmp = atan(t_2, fma(Float64(phi1 * -0.5), Float64(cos(Float64(lambda2 + Float64(phi2 - lambda1))) + cos(Float64(Float64(lambda1 + phi2) - lambda2))), sin(phi2))); else tmp = atan(t_2, Float64(Float64(sin(phi1) * -0.5) * Float64(t_0 + t_0))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[phi1, -2.8e-6], N[ArcTan[t$95$1 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[phi2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 0.0115], N[ArcTan[t$95$2 / N[(N[(phi1 * -0.5), $MachinePrecision] * N[(N[Cos[N[(lambda2 + N[(phi2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(N[(lambda1 + phi2), $MachinePrecision] - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sin[phi2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(N[(N[Sin[phi1], $MachinePrecision] * -0.5), $MachinePrecision] * N[(t$95$0 + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_2 \cdot t\_1\\
\mathbf{if}\;\phi_1 \leq -2.8 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot t\_0}\\
\mathbf{elif}\;\phi_1 \leq 0.0115:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\phi_1 \cdot -0.5, \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right) + \cos \left(\left(\lambda_1 + \phi_2\right) - \lambda_2\right), \sin \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\left(\sin \phi_1 \cdot -0.5\right) \cdot \left(t\_0 + t\_0\right)}\\
\end{array}
\end{array}
if phi1 < -2.79999999999999987e-6Initial program 73.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6446.4
Applied rewrites46.4%
if -2.79999999999999987e-6 < phi1 < 0.0115Initial program 80.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites80.5%
Taylor expanded in phi1 around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-cos.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
lower-sin.f6480.1
Applied rewrites80.1%
if 0.0115 < phi1 Initial program 80.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites62.9%
Taylor expanded in phi2 around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
sub-negN/A
mul-1-negN/A
cos-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lower-+.f64N/A
lower-cos.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower--.f6458.5
Applied rewrites58.5%
Final simplification66.5%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (- (* (cos phi1) (sin phi2)) (* (cos (- lambda1 lambda2)) (sin phi1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos((lambda1 - lambda2)) * 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((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos((lambda1 - lambda2)) * sin(phi1))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos((lambda1 - lambda2)) * math.sin(phi1))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos((lambda1 - lambda2)) * sin(phi1)))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}
\end{array}
Initial program 78.8%
Taylor expanded in phi2 around 0
lower-sin.f6467.1
Applied rewrites67.1%
Final simplification67.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi2) (sin (- lambda1 lambda2))))
(t_1 (atan2 t_0 (sin phi2))))
(if (<= phi2 -0.5)
t_1
(if (<= phi2 1.0)
(atan2
t_0
(-
(* phi2 (* (cos phi1) (fma -0.16666666666666666 (* phi2 phi2) 1.0)))
(*
(cos (- lambda1 lambda2))
(* (sin phi1) (fma -0.5 (* phi2 phi2) 1.0)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi2) * sin((lambda1 - lambda2));
double t_1 = atan2(t_0, sin(phi2));
double tmp;
if (phi2 <= -0.5) {
tmp = t_1;
} else if (phi2 <= 1.0) {
tmp = atan2(t_0, ((phi2 * (cos(phi1) * fma(-0.16666666666666666, (phi2 * phi2), 1.0))) - (cos((lambda1 - lambda2)) * (sin(phi1) * fma(-0.5, (phi2 * phi2), 1.0)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))) t_1 = atan(t_0, sin(phi2)) tmp = 0.0 if (phi2 <= -0.5) tmp = t_1; elseif (phi2 <= 1.0) tmp = atan(t_0, Float64(Float64(phi2 * Float64(cos(phi1) * fma(-0.16666666666666666, Float64(phi2 * phi2), 1.0))) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * fma(-0.5, Float64(phi2 * phi2), 1.0))))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.5], t$95$1, If[LessEqual[phi2, 1.0], N[ArcTan[t$95$0 / N[(N[(phi2 * N[(N[Cos[phi1], $MachinePrecision] * N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(-0.5 * N[(phi2 * phi2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 1:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \left(\cos \phi_1 \cdot \mathsf{fma}\left(-0.16666666666666666, \phi_2 \cdot \phi_2, 1\right)\right) - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(-0.5, \phi_2 \cdot \phi_2, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -0.5 or 1 < phi2 Initial program 73.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.8%
Taylor expanded in phi1 around 0
lower-sin.f6450.3
Applied rewrites50.3%
if -0.5 < phi2 < 1Initial program 84.4%
Taylor expanded in phi2 around 0
associate-*r*N/A
distribute-rgt1-inN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f6483.7
Applied rewrites83.7%
Taylor expanded in phi2 around 0
lower-*.f64N/A
associate-*r*N/A
distribute-rgt1-inN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f6483.8
Applied rewrites83.8%
Final simplification66.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (fma -0.5 (* phi2 phi2) 1.0))
(t_1 (sin (- lambda1 lambda2)))
(t_2 (atan2 (* (cos phi2) t_1) (sin phi2))))
(if (<= phi2 -0.105)
t_2
(if (<= phi2 1.0)
(atan2
(* t_1 t_0)
(-
(* (cos phi1) (sin phi2))
(* (cos (- lambda1 lambda2)) (* (sin phi1) t_0))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = fma(-0.5, (phi2 * phi2), 1.0);
double t_1 = sin((lambda1 - lambda2));
double t_2 = atan2((cos(phi2) * t_1), sin(phi2));
double tmp;
if (phi2 <= -0.105) {
tmp = t_2;
} else if (phi2 <= 1.0) {
tmp = atan2((t_1 * t_0), ((cos(phi1) * sin(phi2)) - (cos((lambda1 - lambda2)) * (sin(phi1) * t_0))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = fma(-0.5, Float64(phi2 * phi2), 1.0) t_1 = sin(Float64(lambda1 - lambda2)) t_2 = atan(Float64(cos(phi2) * t_1), sin(phi2)) tmp = 0.0 if (phi2 <= -0.105) tmp = t_2; elseif (phi2 <= 1.0) tmp = atan(Float64(t_1 * t_0), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(Float64(lambda1 - lambda2)) * Float64(sin(phi1) * t_0)))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(-0.5 * N[(phi2 * phi2), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.105], t$95$2, If[LessEqual[phi2, 1.0], N[ArcTan[N[(t$95$1 * t$95$0), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.5, \phi_2 \cdot \phi_2, 1\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.105:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_2 \leq 1:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1 \cdot t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\sin \phi_1 \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi2 < -0.104999999999999996 or 1 < phi2 Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
Taylor expanded in phi1 around 0
lower-sin.f6450.2
Applied rewrites50.2%
if -0.104999999999999996 < phi2 < 1Initial program 84.8%
Taylor expanded in phi2 around 0
associate-*r*N/A
distribute-rgt1-inN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f6484.2
Applied rewrites84.2%
Taylor expanded in phi2 around 0
associate-*r*N/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower--.f6484.2
Applied rewrites84.2%
Final simplification66.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -0.5)
t_1
(if (<= phi2 0.054)
(atan2
t_0
(- (* phi2 (cos phi1)) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -0.5) {
tmp = t_1;
} else if (phi2 <= 0.054) {
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * 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((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-0.5d0)) then
tmp = t_1
else if (phi2 <= 0.054d0) then
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * 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((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -0.5) {
tmp = t_1;
} else if (phi2 <= 0.054) {
tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -0.5: tmp = t_1 elif phi2 <= 0.054: tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -0.5) tmp = t_1; elseif (phi2 <= 0.054) tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -0.5) tmp = t_1; elseif (phi2 <= 0.054) tmp = atan2(t_0, ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.5], t$95$1, If[LessEqual[phi2, 0.054], N[ArcTan[t$95$0 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.054:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -0.5 or 0.0539999999999999994 < phi2 Initial program 73.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites55.1%
Taylor expanded in phi1 around 0
lower-sin.f6450.1
Applied rewrites50.1%
if -0.5 < phi2 < 0.0539999999999999994Initial program 84.2%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6484.0
Applied rewrites84.0%
Taylor expanded in phi2 around 0
lower-sin.f6484.2
Applied rewrites84.2%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-cos.f6484.3
Applied rewrites84.3%
Final simplification66.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -0.0014)
t_1
(if (<= phi2 0.98)
(atan2 t_0 (- (sin phi2) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -0.0014) {
tmp = t_1;
} else if (phi2 <= 0.98) {
tmp = atan2(t_0, (sin(phi2) - (cos((lambda1 - lambda2)) * 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((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-0.0014d0)) then
tmp = t_1
else if (phi2 <= 0.98d0) then
tmp = atan2(t_0, (sin(phi2) - (cos((lambda1 - lambda2)) * 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((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -0.0014) {
tmp = t_1;
} else if (phi2 <= 0.98) {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -0.0014: tmp = t_1 elif phi2 <= 0.98: tmp = math.atan2(t_0, (math.sin(phi2) - (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -0.0014) tmp = t_1; elseif (phi2 <= 0.98) tmp = atan(t_0, Float64(sin(phi2) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -0.0014) tmp = t_1; elseif (phi2 <= 0.98) tmp = atan2(t_0, (sin(phi2) - (cos((lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.0014], t$95$1, If[LessEqual[phi2, 0.98], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.0014:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.98:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -0.00139999999999999999 or 0.97999999999999998 < phi2 Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
Taylor expanded in phi1 around 0
lower-sin.f6450.2
Applied rewrites50.2%
if -0.00139999999999999999 < phi2 < 0.97999999999999998Initial program 84.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6483.9
Applied rewrites83.9%
Taylor expanded in phi2 around 0
lower-sin.f6484.1
Applied rewrites84.1%
Taylor expanded in phi1 around 0
lower-sin.f6483.4
Applied rewrites83.4%
Final simplification66.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -0.0003)
t_1
(if (<= phi2 0.98)
(atan2 t_0 (- (sin phi2) (* (sin phi1) (cos lambda2))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -0.0003) {
tmp = t_1;
} else if (phi2 <= 0.98) {
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda2))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-0.0003d0)) then
tmp = t_1
else if (phi2 <= 0.98d0) then
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda2))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -0.0003) {
tmp = t_1;
} else if (phi2 <= 0.98) {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.sin(phi1) * Math.cos(lambda2))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -0.0003: tmp = t_1 elif phi2 <= 0.98: tmp = math.atan2(t_0, (math.sin(phi2) - (math.sin(phi1) * math.cos(lambda2)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -0.0003) tmp = t_1; elseif (phi2 <= 0.98) tmp = atan(t_0, Float64(sin(phi2) - Float64(sin(phi1) * cos(lambda2)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -0.0003) tmp = t_1; elseif (phi2 <= 0.98) tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda2)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.0003], t$95$1, If[LessEqual[phi2, 0.98], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.0003:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.98:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \sin \phi_1 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -2.99999999999999974e-4 or 0.97999999999999998 < phi2 Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
Taylor expanded in phi1 around 0
lower-sin.f6450.2
Applied rewrites50.2%
if -2.99999999999999974e-4 < phi2 < 0.97999999999999998Initial program 84.8%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6483.9
Applied rewrites83.9%
Taylor expanded in phi2 around 0
lower-sin.f6484.1
Applied rewrites84.1%
Taylor expanded in phi1 around 0
lower-sin.f6483.4
Applied rewrites83.4%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6473.5
Applied rewrites73.5%
Final simplification61.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
(if (<= phi2 -8e-5)
t_1
(if (<= phi2 7e-22)
(atan2 t_0 (- (sin phi2) (* (sin phi1) (cos lambda1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
double tmp;
if (phi2 <= -8e-5) {
tmp = t_1;
} else if (phi2 <= 7e-22) {
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda1))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((cos(phi2) * t_0), sin(phi2))
if (phi2 <= (-8d-5)) then
tmp = t_1
else if (phi2 <= 7d-22) then
tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
double tmp;
if (phi2 <= -8e-5) {
tmp = t_1;
} else if (phi2 <= 7e-22) {
tmp = Math.atan2(t_0, (Math.sin(phi2) - (Math.sin(phi1) * Math.cos(lambda1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2)) tmp = 0 if phi2 <= -8e-5: tmp = t_1 elif phi2 <= 7e-22: tmp = math.atan2(t_0, (math.sin(phi2) - (math.sin(phi1) * math.cos(lambda1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2)) tmp = 0.0 if (phi2 <= -8e-5) tmp = t_1; elseif (phi2 <= 7e-22) tmp = atan(t_0, Float64(sin(phi2) - Float64(sin(phi1) * cos(lambda1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((cos(phi2) * t_0), sin(phi2)); tmp = 0.0; if (phi2 <= -8e-5) tmp = t_1; elseif (phi2 <= 7e-22) tmp = atan2(t_0, (sin(phi2) - (sin(phi1) * cos(lambda1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -8e-5], t$95$1, If[LessEqual[phi2, 7e-22], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -8 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 7 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - \sin \phi_1 \cdot \cos \lambda_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -8.00000000000000065e-5 or 7.00000000000000011e-22 < phi2 Initial program 72.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.5%
Taylor expanded in phi1 around 0
lower-sin.f6448.8
Applied rewrites48.8%
if -8.00000000000000065e-5 < phi2 < 7.00000000000000011e-22Initial program 86.9%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6486.9
Applied rewrites86.9%
Taylor expanded in phi2 around 0
lower-sin.f6486.9
Applied rewrites86.9%
Taylor expanded in phi1 around 0
lower-sin.f6486.6
Applied rewrites86.6%
Taylor expanded in lambda2 around 0
lower-cos.f6473.9
Applied rewrites73.9%
Final simplification60.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi1 5.1e+45)
(atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (sin phi2))
(atan2
(sin lambda1)
(- (sin phi2) (* (cos (- lambda1 lambda2)) (sin phi1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi1 <= 5.1e+45) {
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2));
} else {
tmp = atan2(sin(lambda1), (sin(phi2) - (cos((lambda1 - lambda2)) * sin(phi1))));
}
return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi1 <= 5.1d+45) then
tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2))
else
tmp = atan2(sin(lambda1), (sin(phi2) - (cos((lambda1 - lambda2)) * sin(phi1))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi1 <= 5.1e+45) {
tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), Math.sin(phi2));
} else {
tmp = Math.atan2(Math.sin(lambda1), (Math.sin(phi2) - (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi1 <= 5.1e+45: tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), math.sin(phi2)) else: tmp = math.atan2(math.sin(lambda1), (math.sin(phi2) - (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi1 <= 5.1e+45) tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), sin(phi2)); else tmp = atan(sin(lambda1), Float64(sin(phi2) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi1 <= 5.1e+45) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2)); else tmp = atan2(sin(lambda1), (sin(phi2) - (cos((lambda1 - lambda2)) * sin(phi1)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi1, 5.1e+45], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_1 \leq 5.1 \cdot 10^{+45}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\sin \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\end{array}
\end{array}
if phi1 < 5.0999999999999997e45Initial program 78.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.8%
Taylor expanded in phi1 around 0
lower-sin.f6458.5
Applied rewrites58.5%
if 5.0999999999999997e45 < phi1 Initial program 79.4%
Taylor expanded in phi2 around 0
lower-sin.f64N/A
lower--.f6451.7
Applied rewrites51.7%
Taylor expanded in phi2 around 0
lower-sin.f6451.7
Applied rewrites51.7%
Taylor expanded in phi1 around 0
lower-sin.f6449.2
Applied rewrites49.2%
Taylor expanded in lambda2 around 0
Applied rewrites28.8%
Final simplification51.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
\end{array}
Initial program 78.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
cos-multN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites68.9%
Taylor expanded in phi1 around 0
lower-sin.f6449.1
Applied rewrites49.1%
Final simplification49.1%
herbie shell --seed 2024233
(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))))))