
(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)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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}
Herbie found 36 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)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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 lambda1) (sin lambda2)))
(cos phi2))
(-
(* (cos phi1) (sin phi2))
(*
(* (sin phi1) (cos phi2))
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}
\end{array}
Initial program 79.1%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.3
Applied rewrites89.3%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2)))
(t_2 (cos (- lambda1 lambda2))))
(if (<= phi2 -0.00106)
(atan2
t_1
(fma (sin phi2) (cos phi1) (* (- (cos phi2)) (* t_2 (sin phi1)))))
(if (<= phi2 2e-14)
(atan2
t_1
(-
(sin phi2)
(*
t_0
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2 t_1 (- (* (cos phi1) (sin phi2)) (* t_0 t_2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2);
double t_2 = cos((lambda1 - lambda2));
double tmp;
if (phi2 <= -0.00106) {
tmp = atan2(t_1, fma(sin(phi2), cos(phi1), (-cos(phi2) * (t_2 * sin(phi1)))));
} else if (phi2 <= 2e-14) {
tmp = atan2(t_1, (sin(phi2) - (t_0 * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - (t_0 * t_2)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)) t_2 = cos(Float64(lambda1 - lambda2)) tmp = 0.0 if (phi2 <= -0.00106) tmp = atan(t_1, fma(sin(phi2), cos(phi1), Float64(Float64(-cos(phi2)) * Float64(t_2 * sin(phi1))))); elseif (phi2 <= 2e-14) tmp = atan(t_1, Float64(sin(phi2) - Float64(t_0 * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(t_1, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * t_2))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.00106], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-N[Cos[phi2], $MachinePrecision]) * N[(t$95$2 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2e-14], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] - N[(t$95$0 * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.00106:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\cos \phi_2\right) \cdot \left(t\_2 \cdot \sin \phi_1\right)\right)}\\
\mathbf{elif}\;\phi_2 \leq 2 \cdot 10^{-14}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\sin \phi_2 - t\_0 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot t\_2}\\
\end{array}
\end{array}
if phi2 < -0.00105999999999999996Initial program 77.1%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.9
Applied rewrites89.9%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
associate-*r*N/A
*-commutativeN/A
Applied rewrites89.9%
if -0.00105999999999999996 < phi2 < 2e-14Initial program 81.7%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.1
Applied rewrites89.1%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in phi1 around 0
lift-sin.f6499.6
Applied rewrites99.6%
if 2e-14 < phi2 Initial program 76.2%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.2
Applied rewrites89.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (- (sin lambda2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (* (sin phi1) (cos phi2)))
(t_3
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- t_1 (* t_2 (cos lambda1))))))
(if (<= lambda1 -3.1e-5)
t_3
(if (<= lambda1 1.75e-9)
(atan2
(* (fma (cos lambda2) lambda1 t_0) (cos phi2))
(- t_1 (* t_2 (fma (- lambda1) t_0 (cos lambda2)))))
t_3))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -sin(lambda2);
double t_1 = cos(phi1) * sin(phi2);
double t_2 = sin(phi1) * cos(phi2);
double t_3 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_1 - (t_2 * cos(lambda1))));
double tmp;
if (lambda1 <= -3.1e-5) {
tmp = t_3;
} else if (lambda1 <= 1.75e-9) {
tmp = atan2((fma(cos(lambda2), lambda1, t_0) * cos(phi2)), (t_1 - (t_2 * fma(-lambda1, t_0, cos(lambda2)))));
} else {
tmp = t_3;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(-sin(lambda2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(sin(phi1) * cos(phi2)) t_3 = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_1 - Float64(t_2 * cos(lambda1)))) tmp = 0.0 if (lambda1 <= -3.1e-5) tmp = t_3; elseif (lambda1 <= 1.75e-9) tmp = atan(Float64(fma(cos(lambda2), lambda1, t_0) * cos(phi2)), Float64(t_1 - Float64(t_2 * fma(Float64(-lambda1), t_0, cos(lambda2))))); else tmp = t_3; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = (-N[Sin[lambda2], $MachinePrecision])}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$2 * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -3.1e-5], t$95$3, If[LessEqual[lambda1, 1.75e-9], N[ArcTan[N[(N[(N[Cos[lambda2], $MachinePrecision] * lambda1 + t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(t$95$2 * N[((-lambda1) * t$95$0 + N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\sin \lambda_2\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := \sin \phi_1 \cdot \cos \phi_2\\
t_3 := \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_1 - t\_2 \cdot \cos \lambda_1}\\
\mathbf{if}\;\lambda_1 \leq -3.1 \cdot 10^{-5}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\lambda_1 \leq 1.75 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\cos \lambda_2, \lambda_1, t\_0\right) \cdot \cos \phi_2}{t\_1 - t\_2 \cdot \mathsf{fma}\left(-\lambda_1, t\_0, \cos \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if lambda1 < -3.10000000000000014e-5 or 1.75e-9 < lambda1 Initial program 59.5%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.4
Applied rewrites79.4%
Taylor expanded in lambda1 around inf
Applied rewrites79.3%
if -3.10000000000000014e-5 < lambda1 < 1.75e-9Initial program 99.5%
Taylor expanded in lambda1 around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
sin-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f6499.5
Applied rewrites99.5%
Taylor expanded in lambda1 around 0
+-commutativeN/A
cos-neg-revN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
sin-neg-revN/A
lift-sin.f64N/A
lift-neg.f6499.7
Applied rewrites99.7%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2))) (cos phi2)) (fma (sin phi2) (cos phi1) (* (- (cos phi2)) (* (cos (- lambda1 lambda2)) (sin phi1))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), fma(sin(phi2), cos(phi1), (-cos(phi2) * (cos((lambda1 - lambda2)) * sin(phi1)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-cos(phi2)) * Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $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{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\cos \phi_2\right) \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)}
\end{array}
Initial program 79.1%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.3
Applied rewrites89.3%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
associate-*r*N/A
*-commutativeN/A
Applied rewrites89.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin 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) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((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) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(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) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(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(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(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) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 79.1%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.3
Applied rewrites89.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos lambda1) (sin lambda2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_1)))
(t_3 (* (sin lambda1) (cos lambda2))))
(if (<= phi1 -3.7e-8)
(atan2 (* (- t_3 (sin lambda2)) (cos phi2)) t_2)
(if (<= phi1 3.05e-16)
(atan2
(* (- t_3 t_0) (cos phi2))
(fma (* -1.0 phi1) (* t_1 (cos phi2)) (sin phi2)))
(atan2 (* (- (sin lambda1) t_0) (cos phi2)) t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(lambda1) * sin(lambda2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = (cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_1);
double t_3 = sin(lambda1) * cos(lambda2);
double tmp;
if (phi1 <= -3.7e-8) {
tmp = atan2(((t_3 - sin(lambda2)) * cos(phi2)), t_2);
} else if (phi1 <= 3.05e-16) {
tmp = atan2(((t_3 - t_0) * cos(phi2)), fma((-1.0 * phi1), (t_1 * cos(phi2)), sin(phi2)));
} else {
tmp = atan2(((sin(lambda1) - t_0) * cos(phi2)), t_2);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(lambda1) * sin(lambda2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_1)) t_3 = Float64(sin(lambda1) * cos(lambda2)) tmp = 0.0 if (phi1 <= -3.7e-8) tmp = atan(Float64(Float64(t_3 - sin(lambda2)) * cos(phi2)), t_2); elseif (phi1 <= 3.05e-16) tmp = atan(Float64(Float64(t_3 - t_0) * cos(phi2)), fma(Float64(-1.0 * phi1), Float64(t_1 * cos(phi2)), sin(phi2))); else tmp = atan(Float64(Float64(sin(lambda1) - t_0) * cos(phi2)), 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[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3.7e-8], N[ArcTan[N[(N[(t$95$3 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision], If[LessEqual[phi1, 3.05e-16], N[ArcTan[N[(N[(t$95$3 - t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 * phi1), $MachinePrecision] * N[(t$95$1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + N[Sin[phi2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \lambda_1 \cdot \sin \lambda_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_1\\
t_3 := \sin \lambda_1 \cdot \cos \lambda_2\\
\mathbf{if}\;\phi_1 \leq -3.7 \cdot 10^{-8}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_3 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_2}\\
\mathbf{elif}\;\phi_1 \leq 3.05 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_3 - t\_0\right) \cdot \cos \phi_2}{\mathsf{fma}\left(-1 \cdot \phi_1, t\_1 \cdot \cos \phi_2, \sin \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - t\_0\right) \cdot \cos \phi_2}{t\_2}\\
\end{array}
\end{array}
if phi1 < -3.7e-8Initial program 76.7%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.8
Applied rewrites79.8%
Taylor expanded in lambda1 around 0
lift-sin.f6477.7
Applied rewrites77.7%
if -3.7e-8 < phi1 < 3.04999999999999976e-16Initial program 82.3%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in phi1 around 0
sin-+PI/2-revN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if 3.04999999999999976e-16 < phi1 Initial program 75.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.0
Applied rewrites79.0%
Taylor expanded in lambda2 around 0
lift-sin.f6476.5
Applied rewrites76.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (cos lambda1) (sin lambda2)))
(t_2
(atan2
(* (- (sin lambda1) t_1) (cos phi2))
(- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_0)))))
(if (<= phi1 -8.5e-8)
t_2
(if (<= phi1 3.05e-16)
(atan2
(* (- (* (sin lambda1) (cos lambda2)) t_1) (cos phi2))
(fma (* -1.0 phi1) (* t_0 (cos phi2)) (sin phi2)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = cos(lambda1) * sin(lambda2);
double t_2 = atan2(((sin(lambda1) - t_1) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0)));
double tmp;
if (phi1 <= -8.5e-8) {
tmp = t_2;
} else if (phi1 <= 3.05e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - t_1) * cos(phi2)), fma((-1.0 * phi1), (t_0 * cos(phi2)), sin(phi2)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(cos(lambda1) * sin(lambda2)) t_2 = atan(Float64(Float64(sin(lambda1) - t_1) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0))) tmp = 0.0 if (phi1 <= -8.5e-8) tmp = t_2; elseif (phi1 <= 3.05e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - t_1) * cos(phi2)), fma(Float64(-1.0 * phi1), Float64(t_0 * cos(phi2)), sin(phi2))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - t$95$1), $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] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -8.5e-8], t$95$2, If[LessEqual[phi1, 3.05e-16], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 * phi1), $MachinePrecision] * N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + N[Sin[phi2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \lambda_1 \cdot \sin \lambda_2\\
t_2 := \tan^{-1}_* \frac{\left(\sin \lambda_1 - t\_1\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_0}\\
\mathbf{if}\;\phi_1 \leq -8.5 \cdot 10^{-8}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 3.05 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_1\right) \cdot \cos \phi_2}{\mathsf{fma}\left(-1 \cdot \phi_1, t\_0 \cdot \cos \phi_2, \sin \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -8.49999999999999935e-8 or 3.04999999999999976e-16 < phi1 Initial program 76.0%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.3
Applied rewrites79.3%
Taylor expanded in lambda2 around 0
lift-sin.f6477.2
Applied rewrites77.2%
if -8.49999999999999935e-8 < phi1 < 3.04999999999999976e-16Initial program 82.3%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in phi1 around 0
sin-+PI/2-revN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin (- lambda1 lambda2)) (cos phi2))))
(if (<= phi1 -3.7e-8)
(atan2 t_2 (fma (sin phi2) (cos phi1) (* (- t_0) t_1)))
(if (<= phi1 6e-11)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(fma (* -1.0 phi1) (* t_1 (cos phi2)) (sin phi2)))
(atan2 t_2 (- (* (cos phi1) (sin phi2)) (* t_0 t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (phi1 <= -3.7e-8) {
tmp = atan2(t_2, fma(sin(phi2), cos(phi1), (-t_0 * t_1)));
} else if (phi1 <= 6e-11) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), fma((-1.0 * phi1), (t_1 * cos(phi2)), sin(phi2)));
} else {
tmp = atan2(t_2, ((cos(phi1) * sin(phi2)) - (t_0 * t_1)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (phi1 <= -3.7e-8) tmp = atan(t_2, fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * t_1))); elseif (phi1 <= 6e-11) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), fma(Float64(-1.0 * phi1), Float64(t_1 * cos(phi2)), sin(phi2))); else tmp = atan(t_2, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * t_1))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3.7e-8], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-t$95$0) * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 6e-11], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 * phi1), $MachinePrecision] * N[(t$95$1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + N[Sin[phi2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_1 \leq -3.7 \cdot 10^{-8}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-t\_0\right) \cdot t\_1\right)}\\
\mathbf{elif}\;\phi_1 \leq 6 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(-1 \cdot \phi_1, t\_1 \cdot \cos \phi_2, \sin \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -3.7e-8Initial program 76.7%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
Applied rewrites76.8%
if -3.7e-8 < phi1 < 6e-11Initial program 82.2%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in phi1 around 0
sin-+PI/2-revN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if 6e-11 < phi1 Initial program 75.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2)))
(t_1 (* (cos phi1) (sin phi2))))
(if (<= lambda2 -0.0009)
t_0
(if (<= lambda2 1.35)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_1 (* (* (cos lambda1) (cos phi2)) (sin phi1))))
(if (<= lambda2 2.05e+147)
t_0
(atan2
(* (sin (- lambda2)) (cos phi2))
(- t_1 (* (* (cos lambda2) (sin phi1)) (cos phi2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
double t_1 = cos(phi1) * sin(phi2);
double tmp;
if (lambda2 <= -0.0009) {
tmp = t_0;
} else if (lambda2 <= 1.35) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((cos(lambda1) * cos(phi2)) * sin(phi1))));
} else if (lambda2 <= 2.05e+147) {
tmp = t_0;
} else {
tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - ((cos(lambda2) * sin(phi1)) * cos(phi2))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
t_1 = cos(phi1) * sin(phi2)
if (lambda2 <= (-0.0009d0)) then
tmp = t_0
else if (lambda2 <= 1.35d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((cos(lambda1) * cos(phi2)) * sin(phi1))))
else if (lambda2 <= 2.05d+147) then
tmp = t_0
else
tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - ((cos(lambda2) * sin(phi1)) * cos(phi2))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
double t_1 = Math.cos(phi1) * Math.sin(phi2);
double tmp;
if (lambda2 <= -0.0009) {
tmp = t_0;
} else if (lambda2 <= 1.35) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_1 - ((Math.cos(lambda1) * Math.cos(phi2)) * Math.sin(phi1))));
} else if (lambda2 <= 2.05e+147) {
tmp = t_0;
} else {
tmp = Math.atan2((Math.sin(-lambda2) * Math.cos(phi2)), (t_1 - ((Math.cos(lambda2) * Math.sin(phi1)) * Math.cos(phi2))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) t_1 = math.cos(phi1) * math.sin(phi2) tmp = 0 if lambda2 <= -0.0009: tmp = t_0 elif lambda2 <= 1.35: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_1 - ((math.cos(lambda1) * math.cos(phi2)) * math.sin(phi1)))) elif lambda2 <= 2.05e+147: tmp = t_0 else: tmp = math.atan2((math.sin(-lambda2) * math.cos(phi2)), (t_1 - ((math.cos(lambda2) * math.sin(phi1)) * math.cos(phi2)))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)) t_1 = Float64(cos(phi1) * sin(phi2)) tmp = 0.0 if (lambda2 <= -0.0009) tmp = t_0; elseif (lambda2 <= 1.35) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_1 - Float64(Float64(cos(lambda1) * cos(phi2)) * sin(phi1)))); elseif (lambda2 <= 2.05e+147) tmp = t_0; else tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), Float64(t_1 - Float64(Float64(cos(lambda2) * sin(phi1)) * cos(phi2)))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); t_1 = cos(phi1) * sin(phi2); tmp = 0.0; if (lambda2 <= -0.0009) tmp = t_0; elseif (lambda2 <= 1.35) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_1 - ((cos(lambda1) * cos(phi2)) * sin(phi1)))); elseif (lambda2 <= 2.05e+147) tmp = t_0; else tmp = atan2((sin(-lambda2) * cos(phi2)), (t_1 - ((cos(lambda2) * sin(phi1)) * cos(phi2)))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -0.0009], t$95$0, If[LessEqual[lambda2, 1.35], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 2.05e+147], t$95$0, N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\lambda_2 \leq -0.0009:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_2 \leq 1.35:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1 - \left(\cos \lambda_1 \cdot \cos \phi_2\right) \cdot \sin \phi_1}\\
\mathbf{elif}\;\lambda_2 \leq 2.05 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{t\_1 - \left(\cos \lambda_2 \cdot \sin \phi_1\right) \cdot \cos \phi_2}\\
\end{array}
\end{array}
if lambda2 < -8.9999999999999998e-4 or 1.3500000000000001 < lambda2 < 2.04999999999999983e147Initial program 59.9%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.8
Applied rewrites79.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in phi1 around 0
lift-sin.f6460.3
Applied rewrites60.3%
if -8.9999999999999998e-4 < lambda2 < 1.3500000000000001Initial program 99.2%
Taylor expanded in lambda2 around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-cos.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
if 2.04999999999999983e147 < lambda2 Initial program 59.4%
Taylor expanded in lambda1 around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lift-sin.f64N/A
lift-cos.f6459.3
Applied rewrites59.3%
Taylor expanded in lambda1 around 0
mul-1-negN/A
lower-neg.f6459.6
Applied rewrites59.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))))
(if (<= lambda2 -0.0009)
t_0
(if (<= lambda2 1.35)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma
(sin phi2)
(cos phi1)
(* (- (cos lambda1)) (* (sin phi1) (cos phi2)))))
(if (<= lambda2 2.05e+147)
t_0
(atan2
(* (sin (- lambda2)) (cos phi2))
(-
(* (cos phi1) (sin phi2))
(* (* (cos lambda2) (sin phi1)) (cos phi2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
double tmp;
if (lambda2 <= -0.0009) {
tmp = t_0;
} else if (lambda2 <= 1.35) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), (-cos(lambda1) * (sin(phi1) * cos(phi2)))));
} else if (lambda2 <= 2.05e+147) {
tmp = t_0;
} else {
tmp = atan2((sin(-lambda2) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)) tmp = 0.0 if (lambda2 <= -0.0009) tmp = t_0; elseif (lambda2 <= 1.35) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-cos(lambda1)) * Float64(sin(phi1) * cos(phi2))))); elseif (lambda2 <= 2.05e+147) tmp = t_0; else tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(lambda2) * sin(phi1)) * cos(phi2)))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -0.0009], t$95$0, If[LessEqual[lambda2, 1.35], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 2.05e+147], t$95$0, N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\lambda_2 \leq -0.0009:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_2 \leq 1.35:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\cos \lambda_1\right) \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)}\\
\mathbf{elif}\;\lambda_2 \leq 2.05 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \lambda_2 \cdot \sin \phi_1\right) \cdot \cos \phi_2}\\
\end{array}
\end{array}
if lambda2 < -8.9999999999999998e-4 or 1.3500000000000001 < lambda2 < 2.04999999999999983e147Initial program 59.9%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.8
Applied rewrites79.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in phi1 around 0
lift-sin.f6460.3
Applied rewrites60.3%
if -8.9999999999999998e-4 < lambda2 < 1.3500000000000001Initial program 99.2%
Taylor expanded in lambda2 around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f6498.9
Applied rewrites98.9%
if 2.04999999999999983e147 < lambda2 Initial program 59.4%
Taylor expanded in lambda1 around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lift-sin.f64N/A
lift-cos.f6459.3
Applied rewrites59.3%
Taylor expanded in lambda1 around 0
mul-1-negN/A
lower-neg.f6459.6
Applied rewrites59.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1 (cos (- lambda1 lambda2)))
(t_2 (* (sin (- lambda1 lambda2)) (cos phi2))))
(if (<= phi1 -3e-79)
(atan2 t_2 (fma (sin phi2) (cos phi1) (* (- t_0) t_1)))
(if (<= phi1 1.4e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))
(atan2 t_2 (- (* (cos phi1) (sin phi2)) (* t_0 t_1)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = cos((lambda1 - lambda2));
double t_2 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (phi1 <= -3e-79) {
tmp = atan2(t_2, fma(sin(phi2), cos(phi1), (-t_0 * t_1)));
} else if (phi1 <= 1.4e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
} else {
tmp = atan2(t_2, ((cos(phi1) * sin(phi2)) - (t_0 * t_1)));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = cos(Float64(lambda1 - lambda2)) t_2 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (phi1 <= -3e-79) tmp = atan(t_2, fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * t_1))); elseif (phi1 <= 1.4e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = atan(t_2, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * t_1))); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3e-79], N[ArcTan[t$95$2 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-t$95$0) * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.4e-16], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{-79}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-t\_0\right) \cdot t\_1\right)}\\
\mathbf{elif}\;\phi_1 \leq 1.4 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -3e-79Initial program 77.7%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
Applied rewrites77.7%
if -3e-79 < phi1 < 1.4000000000000001e-16Initial program 82.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in phi1 around 0
lift-sin.f6498.2
Applied rewrites98.2%
if 1.4000000000000001e-16 < phi1 Initial program 75.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(-
(* (cos phi1) (sin phi2))
(* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -3e-79)
t_0
(if (<= phi1 1.4e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3e-79) {
tmp = t_0;
} else if (phi1 <= 1.4e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
if (phi1 <= (-3d-79)) then
tmp = t_0
else if (phi1 <= 1.4d-16) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3e-79) {
tmp = t_0;
} else if (phi1 <= 1.4e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -3e-79: tmp = t_0 elif phi1 <= 1.4e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -3e-79) tmp = t_0; elseif (phi1 <= 1.4e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -3e-79) tmp = t_0; elseif (phi1 <= 1.4e-16) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[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]}, If[LessEqual[phi1, -3e-79], t$95$0, If[LessEqual[phi1, 1.4e-16], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \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)}\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 1.4 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -3e-79 or 1.4000000000000001e-16 < phi1 Initial program 76.6%
if -3e-79 < phi1 < 1.4000000000000001e-16Initial program 82.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in phi1 around 0
lift-sin.f6498.2
Applied rewrites98.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))))
(if (<= lambda1 -0.0255)
t_0
(if (<= lambda1 1.75e-9)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(-
(* (cos phi1) (sin phi2))
(* (* (cos lambda2) (sin phi1)) (cos phi2))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
double tmp;
if (lambda1 <= -0.0255) {
tmp = t_0;
} else if (lambda1 <= 1.75e-9) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2))));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
if (lambda1 <= (-0.0255d0)) then
tmp = t_0
else if (lambda1 <= 1.75d-9) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (lambda1 <= -0.0255) {
tmp = t_0;
} else if (lambda1 <= 1.75e-9) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(lambda2) * Math.sin(phi1)) * Math.cos(phi2))));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if lambda1 <= -0.0255: tmp = t_0 elif lambda1 <= 1.75e-9: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(lambda2) * math.sin(phi1)) * math.cos(phi2)))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)) tmp = 0.0 if (lambda1 <= -0.0255) tmp = t_0; elseif (lambda1 <= 1.75e-9) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(lambda2) * sin(phi1)) * cos(phi2)))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); tmp = 0.0; if (lambda1 <= -0.0255) tmp = t_0; elseif (lambda1 <= 1.75e-9) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2)))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -0.0255], t$95$0, If[LessEqual[lambda1, 1.75e-9], 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[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\lambda_1 \leq -0.0255:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.75 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \lambda_2 \cdot \sin \phi_1\right) \cdot \cos \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -0.0254999999999999984 or 1.75e-9 < lambda1 Initial program 59.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6479.4
Applied rewrites79.4%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in phi1 around 0
lift-sin.f6459.6
Applied rewrites59.6%
if -0.0254999999999999984 < lambda1 < 1.75e-9Initial program 99.4%
Taylor expanded in lambda1 around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lift-sin.f64N/A
lift-cos.f6499.4
Applied rewrites99.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))))
(if (<= lambda1 -7.5e-62)
t_0
(if (<= lambda1 1.36e-9)
(atan2
(* (sin (- lambda2)) (cos phi2))
(-
(* (cos phi1) (sin phi2))
(* (* (cos lambda2) (sin phi1)) (cos phi2))))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
double tmp;
if (lambda1 <= -7.5e-62) {
tmp = t_0;
} else if (lambda1 <= 1.36e-9) {
tmp = atan2((sin(-lambda2) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2))));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
if (lambda1 <= (-7.5d-62)) then
tmp = t_0
else if (lambda1 <= 1.36d-9) then
tmp = atan2((sin(-lambda2) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (lambda1 <= -7.5e-62) {
tmp = t_0;
} else if (lambda1 <= 1.36e-9) {
tmp = Math.atan2((Math.sin(-lambda2) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.cos(lambda2) * Math.sin(phi1)) * Math.cos(phi2))));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if lambda1 <= -7.5e-62: tmp = t_0 elif lambda1 <= 1.36e-9: tmp = math.atan2((math.sin(-lambda2) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.cos(lambda2) * math.sin(phi1)) * math.cos(phi2)))) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)) tmp = 0.0 if (lambda1 <= -7.5e-62) tmp = t_0; elseif (lambda1 <= 1.36e-9) tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(cos(lambda2) * sin(phi1)) * cos(phi2)))); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); tmp = 0.0; if (lambda1 <= -7.5e-62) tmp = t_0; elseif (lambda1 <= 1.36e-9) tmp = atan2((sin(-lambda2) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((cos(lambda2) * sin(phi1)) * cos(phi2)))); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -7.5e-62], t$95$0, If[LessEqual[lambda1, 1.36e-9], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\lambda_1 \leq -7.5 \cdot 10^{-62}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.36 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \lambda_2 \cdot \sin \phi_1\right) \cdot \cos \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -7.5000000000000003e-62 or 1.36000000000000006e-9 < lambda1 Initial program 62.5%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6481.0
Applied rewrites81.0%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in phi1 around 0
lift-sin.f6459.6
Applied rewrites59.6%
if -7.5000000000000003e-62 < lambda1 < 1.36000000000000006e-9Initial program 99.7%
Taylor expanded in lambda1 around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
lift-sin.f64N/A
lift-cos.f6499.7
Applied rewrites99.7%
Taylor expanded in lambda1 around 0
mul-1-negN/A
lower-neg.f6482.9
Applied rewrites82.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2))))
(if (<= phi1 -3e-79)
(atan2 t_1 (- (* (cos phi1) (sin phi2)) (* (sin phi1) t_0)))
(if (<= phi1 1.4e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))
(atan2 t_1 (- (sin phi2) (* (* (sin phi1) (cos phi2)) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (phi1 <= -3e-79) {
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - (sin(phi1) * t_0)));
} else if (phi1 <= 1.4e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
} else {
tmp = atan2(t_1, (sin(phi2) - ((sin(phi1) * cos(phi2)) * t_0)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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))
t_1 = sin((lambda1 - lambda2)) * cos(phi2)
if (phi1 <= (-3d-79)) then
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - (sin(phi1) * t_0)))
else if (phi1 <= 1.4d-16) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
else
tmp = atan2(t_1, (sin(phi2) - ((sin(phi1) * cos(phi2)) * t_0)))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.sin((lambda1 - lambda2)) * Math.cos(phi2);
double tmp;
if (phi1 <= -3e-79) {
tmp = Math.atan2(t_1, ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * t_0)));
} else if (phi1 <= 1.4e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = Math.atan2(t_1, (Math.sin(phi2) - ((Math.sin(phi1) * Math.cos(phi2)) * t_0)));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.sin((lambda1 - lambda2)) * math.cos(phi2) tmp = 0 if phi1 <= -3e-79: tmp = math.atan2(t_1, ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * t_0))) elif phi1 <= 1.4e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) else: tmp = math.atan2(t_1, (math.sin(phi2) - ((math.sin(phi1) * math.cos(phi2)) * t_0))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (phi1 <= -3e-79) tmp = atan(t_1, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * t_0))); elseif (phi1 <= 1.4e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = atan(t_1, Float64(sin(phi2) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)); t_1 = sin((lambda1 - lambda2)) * cos(phi2); tmp = 0.0; if (phi1 <= -3e-79) tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - (sin(phi1) * t_0))); elseif (phi1 <= 1.4e-16) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = atan2(t_1, (sin(phi2) - ((sin(phi1) * cos(phi2)) * t_0))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -3e-79], N[ArcTan[t$95$1 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.4e-16], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{-79}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot t\_0}\\
\mathbf{elif}\;\phi_1 \leq 1.4 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_0}\\
\end{array}
\end{array}
if phi1 < -3e-79Initial program 77.7%
Taylor expanded in phi2 around 0
lift-sin.f6456.5
Applied rewrites56.5%
if -3e-79 < phi1 < 1.4000000000000001e-16Initial program 82.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in phi1 around 0
lift-sin.f6498.2
Applied rewrites98.2%
if 1.4000000000000001e-16 < phi1 Initial program 75.3%
Taylor expanded in phi1 around 0
lift-sin.f6449.8
Applied rewrites49.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(-
(sin phi2)
(* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2)))))))
(if (<= phi1 -3e-79)
t_0
(if (<= phi1 1.4e-16)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (sin(phi2) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3e-79) {
tmp = t_0;
} else if (phi1 <= 1.4e-16) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (sin(phi2) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
if (phi1 <= (-3d-79)) then
tmp = t_0
else if (phi1 <= 1.4d-16) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (Math.sin(phi2) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
double tmp;
if (phi1 <= -3e-79) {
tmp = t_0;
} else if (phi1 <= 1.4e-16) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (math.sin(phi2) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2))))) tmp = 0 if phi1 <= -3e-79: tmp = t_0 elif phi1 <= 1.4e-16: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(sin(phi2) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (phi1 <= -3e-79) tmp = t_0; elseif (phi1 <= 1.4e-16) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (sin(phi2) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2))))); tmp = 0.0; if (phi1 <= -3e-79) tmp = t_0; elseif (phi1 <= 1.4e-16) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3e-79], t$95$0, If[LessEqual[phi1, 1.4e-16], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\phi_1 \leq -3 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 1.4 \cdot 10^{-16}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -3e-79 or 1.4000000000000001e-16 < phi1 Initial program 76.6%
Taylor expanded in phi1 around 0
lift-sin.f6452.9
Applied rewrites52.9%
if -3e-79 < phi1 < 1.4000000000000001e-16Initial program 82.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in phi1 around 0
lift-sin.f6498.2
Applied rewrites98.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- (* (cos (- lambda1 lambda2)) (sin phi1))))))
(if (<= phi1 -2.25e-9)
t_0
(if (<= phi1 4e-6)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), -(cos((lambda1 - lambda2)) * sin(phi1)));
double tmp;
if (phi1 <= -2.25e-9) {
tmp = t_0;
} else if (phi1 <= 4e-6) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), -(cos((lambda1 - lambda2)) * sin(phi1)))
if (phi1 <= (-2.25d-9)) then
tmp = t_0
else if (phi1 <= 4d-6) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), -(Math.cos((lambda1 - lambda2)) * Math.sin(phi1)));
double tmp;
if (phi1 <= -2.25e-9) {
tmp = t_0;
} else if (phi1 <= 4e-6) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), -(math.cos((lambda1 - lambda2)) * math.sin(phi1))) tmp = 0 if phi1 <= -2.25e-9: tmp = t_0 elif phi1 <= 4e-6: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(-Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))) tmp = 0.0 if (phi1 <= -2.25e-9) tmp = t_0; elseif (phi1 <= 4e-6) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin((lambda1 - lambda2)) * cos(phi2)), -(cos((lambda1 - lambda2)) * sin(phi1))); tmp = 0.0; if (phi1 <= -2.25e-9) tmp = t_0; elseif (phi1 <= 4e-6) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / (-N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -2.25e-9], t$95$0, If[LessEqual[phi1, 4e-6], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{-\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -2.25 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_1 \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi1 < -2.24999999999999988e-9 or 3.99999999999999982e-6 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.7
Applied rewrites47.7%
if -2.24999999999999988e-9 < phi1 < 3.99999999999999982e-6Initial program 82.2%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
flip3-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in phi1 around 0
lift-sin.f6496.8
Applied rewrites96.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_2 (atan2 t_1 (- (* t_0 (sin phi1))))))
(if (<= phi1 -0.28)
t_2
(if (<= phi1 0.49)
(atan2
t_1
(-
(*
(fma
(- (* (* phi1 phi1) 0.041666666666666664) 0.5)
(* phi1 phi1)
1.0)
(sin phi2))
(*
(* (* (fma (* phi1 phi1) -0.16666666666666666 1.0) phi1) (cos phi2))
t_0)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double t_2 = atan2(t_1, -(t_0 * sin(phi1)));
double tmp;
if (phi1 <= -0.28) {
tmp = t_2;
} else if (phi1 <= 0.49) {
tmp = atan2(t_1, ((fma((((phi1 * phi1) * 0.041666666666666664) - 0.5), (phi1 * phi1), 1.0) * sin(phi2)) - (((fma((phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_2 = atan(t_1, Float64(-Float64(t_0 * sin(phi1)))) tmp = 0.0 if (phi1 <= -0.28) tmp = t_2; elseif (phi1 <= 0.49) tmp = atan(t_1, Float64(Float64(fma(Float64(Float64(Float64(phi1 * phi1) * 0.041666666666666664) - 0.5), Float64(phi1 * phi1), 1.0) * sin(phi2)) - Float64(Float64(Float64(fma(Float64(phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[t$95$1 / (-N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -0.28], t$95$2, If[LessEqual[phi1, 0.49], N[ArcTan[t$95$1 / N[(N[(N[(N[(N[(N[(phi1 * phi1), $MachinePrecision] * 0.041666666666666664), $MachinePrecision] - 0.5), $MachinePrecision] * N[(phi1 * phi1), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(N[(phi1 * phi1), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{t\_1}{-t\_0 \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -0.28:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 0.49:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\left(\phi_1 \cdot \phi_1\right) \cdot 0.041666666666666664 - 0.5, \phi_1 \cdot \phi_1, 1\right) \cdot \sin \phi_2 - \left(\left(\mathsf{fma}\left(\phi_1 \cdot \phi_1, -0.16666666666666666, 1\right) \cdot \phi_1\right) \cdot \cos \phi_2\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -0.28000000000000003 or 0.48999999999999999 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.7
Applied rewrites47.7%
if -0.28000000000000003 < phi1 < 0.48999999999999999Initial program 82.0%
Taylor expanded in phi1 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in phi1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6481.9
Applied rewrites81.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_2 (atan2 t_1 (- (* t_0 (sin phi1))))))
(if (<= phi1 -0.28)
t_2
(if (<= phi1 0.49)
(atan2
t_1
(-
(* (fma (* phi1 phi1) -0.5 1.0) (sin phi2))
(*
(* (* (fma (* phi1 phi1) -0.16666666666666666 1.0) phi1) (cos phi2))
t_0)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double t_2 = atan2(t_1, -(t_0 * sin(phi1)));
double tmp;
if (phi1 <= -0.28) {
tmp = t_2;
} else if (phi1 <= 0.49) {
tmp = atan2(t_1, ((fma((phi1 * phi1), -0.5, 1.0) * sin(phi2)) - (((fma((phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_2 = atan(t_1, Float64(-Float64(t_0 * sin(phi1)))) tmp = 0.0 if (phi1 <= -0.28) tmp = t_2; elseif (phi1 <= 0.49) tmp = atan(t_1, Float64(Float64(fma(Float64(phi1 * phi1), -0.5, 1.0) * sin(phi2)) - Float64(Float64(Float64(fma(Float64(phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[t$95$1 / (-N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -0.28], t$95$2, If[LessEqual[phi1, 0.49], N[ArcTan[t$95$1 / N[(N[(N[(N[(phi1 * phi1), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(N[(phi1 * phi1), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{t\_1}{-t\_0 \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -0.28:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 0.49:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\phi_1 \cdot \phi_1, -0.5, 1\right) \cdot \sin \phi_2 - \left(\left(\mathsf{fma}\left(\phi_1 \cdot \phi_1, -0.16666666666666666, 1\right) \cdot \phi_1\right) \cdot \cos \phi_2\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -0.28000000000000003 or 0.48999999999999999 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.7
Applied rewrites47.7%
if -0.28000000000000003 < phi1 < 0.48999999999999999Initial program 82.0%
Taylor expanded in phi1 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in phi1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6481.9
Applied rewrites81.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_2 (atan2 t_1 (- (* t_0 (sin phi1))))))
(if (<= phi1 -0.108)
t_2
(if (<= phi1 0.215)
(atan2
t_1
(-
(sin phi2)
(*
(* (* (fma (* phi1 phi1) -0.16666666666666666 1.0) phi1) (cos phi2))
t_0)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double t_2 = atan2(t_1, -(t_0 * sin(phi1)));
double tmp;
if (phi1 <= -0.108) {
tmp = t_2;
} else if (phi1 <= 0.215) {
tmp = atan2(t_1, (sin(phi2) - (((fma((phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_2 = atan(t_1, Float64(-Float64(t_0 * sin(phi1)))) tmp = 0.0 if (phi1 <= -0.108) tmp = t_2; elseif (phi1 <= 0.215) tmp = atan(t_1, Float64(sin(phi2) - Float64(Float64(Float64(fma(Float64(phi1 * phi1), -0.16666666666666666, 1.0) * phi1) * cos(phi2)) * t_0))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[t$95$1 / (-N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -0.108], t$95$2, If[LessEqual[phi1, 0.215], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] - N[(N[(N[(N[(N[(phi1 * phi1), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{t\_1}{-t\_0 \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -0.108:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 0.215:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\sin \phi_2 - \left(\left(\mathsf{fma}\left(\phi_1 \cdot \phi_1, -0.16666666666666666, 1\right) \cdot \phi_1\right) \cdot \cos \phi_2\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -0.107999999999999999 or 0.214999999999999997 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.7
Applied rewrites47.7%
if -0.107999999999999999 < phi1 < 0.214999999999999997Initial program 82.0%
Taylor expanded in phi1 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.9
Applied rewrites81.9%
Taylor expanded in phi1 around 0
lift-sin.f6481.8
Applied rewrites81.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_2 (atan2 t_1 (- (* t_0 (sin phi1))))))
(if (<= phi1 -0.0055)
t_2
(if (<= phi1 1.15e-5)
(atan2 t_1 (fma (* -1.0 phi1) (* t_0 (cos phi2)) (sin phi2)))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double t_2 = atan2(t_1, -(t_0 * sin(phi1)));
double tmp;
if (phi1 <= -0.0055) {
tmp = t_2;
} else if (phi1 <= 1.15e-5) {
tmp = atan2(t_1, fma((-1.0 * phi1), (t_0 * cos(phi2)), sin(phi2)));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_2 = atan(t_1, Float64(-Float64(t_0 * sin(phi1)))) tmp = 0.0 if (phi1 <= -0.0055) tmp = t_2; elseif (phi1 <= 1.15e-5) tmp = atan(t_1, fma(Float64(-1.0 * phi1), Float64(t_0 * cos(phi2)), sin(phi2))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[t$95$1 / (-N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -0.0055], t$95$2, If[LessEqual[phi1, 1.15e-5], N[ArcTan[t$95$1 / N[(N[(-1.0 * phi1), $MachinePrecision] * N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + N[Sin[phi2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{t\_1}{-t\_0 \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -0.0055:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 1.15 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(-1 \cdot \phi_1, t\_0 \cdot \cos \phi_2, \sin \phi_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if phi1 < -0.0054999999999999997 or 1.15e-5 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.8
Applied rewrites47.8%
if -0.0054999999999999997 < phi1 < 1.15e-5Initial program 82.1%
Taylor expanded in phi1 around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-cos.f64N/A
lift-sin.f6481.9
Applied rewrites81.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_1 (atan2 t_0 (sin phi2))))
(if (<= phi2 -0.000145)
t_1
(if (<= phi2 0.00052)
(atan2
t_0
(- (* (cos phi1) phi2) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2)) * cos(phi2);
double t_1 = atan2(t_0, sin(phi2));
double tmp;
if (phi2 <= -0.000145) {
tmp = t_1;
} else if (phi2 <= 0.00052) {
tmp = atan2(t_0, ((cos(phi1) * phi2) - (cos((lambda1 - lambda2)) * sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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)) * cos(phi2)
t_1 = atan2(t_0, sin(phi2))
if (phi2 <= (-0.000145d0)) then
tmp = t_1
else if (phi2 <= 0.00052d0) then
tmp = atan2(t_0, ((cos(phi1) * 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)) * Math.cos(phi2);
double t_1 = Math.atan2(t_0, Math.sin(phi2));
double tmp;
if (phi2 <= -0.000145) {
tmp = t_1;
} else if (phi2 <= 0.00052) {
tmp = Math.atan2(t_0, ((Math.cos(phi1) * 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)) * math.cos(phi2) t_1 = math.atan2(t_0, math.sin(phi2)) tmp = 0 if phi2 <= -0.000145: tmp = t_1 elif phi2 <= 0.00052: tmp = math.atan2(t_0, ((math.cos(phi1) * phi2) - (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_1 = atan(t_0, sin(phi2)) tmp = 0.0 if (phi2 <= -0.000145) tmp = t_1; elseif (phi2 <= 0.00052) tmp = atan(t_0, Float64(Float64(cos(phi1) * 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)) * cos(phi2); t_1 = atan2(t_0, sin(phi2)); tmp = 0.0; if (phi2 <= -0.000145) tmp = t_1; elseif (phi2 <= 0.00052) tmp = atan2(t_0, ((cos(phi1) * 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[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.000145], t$95$1, If[LessEqual[phi2, 0.00052], N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * 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) \cdot \cos \phi_2\\
t_1 := \tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.000145:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.00052:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \phi_2 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.45e-4 or 5.19999999999999954e-4 < phi2 Initial program 76.8%
Taylor expanded in phi1 around 0
lift-sin.f6448.6
Applied rewrites48.6%
if -1.45e-4 < phi2 < 5.19999999999999954e-4Initial program 81.5%
Taylor expanded in phi2 around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6481.3
Applied rewrites81.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* t_0 (cos phi2)) (sin phi2))))
(if (<= phi2 -0.000145)
t_1
(if (<= phi2 0.00086)
(atan2
t_0
(- (* phi2 (cos phi1)) (* (sin phi1) (cos (- lambda1 lambda2)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -0.000145) {
tmp = t_1;
} else if (phi2 <= 0.00086) {
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((t_0 * cos(phi2)), sin(phi2))
if (phi2 <= (-0.000145d0)) then
tmp = t_1
else if (phi2 <= 0.00086d0) then
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((t_0 * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -0.000145) {
tmp = t_1;
} else if (phi2 <= 0.00086) {
tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((t_0 * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -0.000145: tmp = t_1 elif phi2 <= 0.00086: tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -0.000145) tmp = t_1; elseif (phi2 <= 0.00086) tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((t_0 * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -0.000145) tmp = t_1; elseif (phi2 <= 0.00086) tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.000145], t$95$1, If[LessEqual[phi2, 0.00086], N[ArcTan[t$95$0 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -0.000145:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 0.00086:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.45e-4 or 8.59999999999999979e-4 < phi2 Initial program 76.8%
Taylor expanded in phi1 around 0
lift-sin.f6448.6
Applied rewrites48.6%
if -1.45e-4 < phi2 < 8.59999999999999979e-4Initial program 81.4%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.0
Applied rewrites89.0%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
sin-diff-revN/A
*-commutativeN/A
sin-diff-revN/A
lift-sin.f64N/A
lift--.f6481.6
Applied rewrites81.6%
Taylor expanded in phi2 around 0
cos-diff-revN/A
lower--.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lower-cos.f64N/A
lift--.f6481.4
Applied rewrites81.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_1 (atan2 t_0 (- (* (cos (- lambda1 lambda2)) (sin phi1))))))
(if (<= phi1 -1.35e-9)
t_1
(if (<= phi1 1.45e-10) (atan2 t_0 (sin phi2)) t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2)) * cos(phi2);
double t_1 = atan2(t_0, -(cos((lambda1 - lambda2)) * sin(phi1)));
double tmp;
if (phi1 <= -1.35e-9) {
tmp = t_1;
} else if (phi1 <= 1.45e-10) {
tmp = atan2(t_0, sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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)) * cos(phi2)
t_1 = atan2(t_0, -(cos((lambda1 - lambda2)) * sin(phi1)))
if (phi1 <= (-1.35d-9)) then
tmp = t_1
else if (phi1 <= 1.45d-10) then
tmp = atan2(t_0, sin(phi2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2)) * Math.cos(phi2);
double t_1 = Math.atan2(t_0, -(Math.cos((lambda1 - lambda2)) * Math.sin(phi1)));
double tmp;
if (phi1 <= -1.35e-9) {
tmp = t_1;
} else if (phi1 <= 1.45e-10) {
tmp = Math.atan2(t_0, Math.sin(phi2));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) * math.cos(phi2) t_1 = math.atan2(t_0, -(math.cos((lambda1 - lambda2)) * math.sin(phi1))) tmp = 0 if phi1 <= -1.35e-9: tmp = t_1 elif phi1 <= 1.45e-10: tmp = math.atan2(t_0, math.sin(phi2)) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) t_1 = atan(t_0, Float64(-Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))) tmp = 0.0 if (phi1 <= -1.35e-9) tmp = t_1; elseif (phi1 <= 1.45e-10) tmp = atan(t_0, sin(phi2)); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)) * cos(phi2); t_1 = atan2(t_0, -(cos((lambda1 - lambda2)) * sin(phi1))); tmp = 0.0; if (phi1 <= -1.35e-9) tmp = t_1; elseif (phi1 <= 1.45e-10) tmp = atan2(t_0, sin(phi2)); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[t$95$0 / (-N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[phi1, -1.35e-9], t$95$1, If[LessEqual[phi1, 1.45e-10], N[ArcTan[t$95$0 / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
t_1 := \tan^{-1}_* \frac{t\_0}{-\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{if}\;\phi_1 \leq -1.35 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 1.45 \cdot 10^{-10}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -1.3500000000000001e-9 or 1.4499999999999999e-10 < phi1 Initial program 76.1%
Taylor expanded in phi2 around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6447.7
Applied rewrites47.7%
if -1.3500000000000001e-9 < phi1 < 1.4499999999999999e-10Initial program 82.2%
Taylor expanded in phi1 around 0
lift-sin.f6479.5
Applied rewrites79.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (sin (- lambda1 lambda2)))
(t_1 (atan2 (* t_0 (cos phi2)) (sin phi2))))
(if (<= phi2 -1.6e-7)
t_1
(if (<= phi2 1.35e-7)
(atan2 t_0 (* -1.0 (* (sin phi1) (cos (- lambda1 lambda2)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -1.6e-7) {
tmp = t_1;
} else if (phi2 <= 1.35e-7) {
tmp = atan2(t_0, (-1.0 * (sin(phi1) * cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin((lambda1 - lambda2))
t_1 = atan2((t_0 * cos(phi2)), sin(phi2))
if (phi2 <= (-1.6d-7)) then
tmp = t_1
else if (phi2 <= 1.35d-7) then
tmp = atan2(t_0, ((-1.0d0) * (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((t_0 * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -1.6e-7) {
tmp = t_1;
} else if (phi2 <= 1.35e-7) {
tmp = Math.atan2(t_0, (-1.0 * (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((t_0 * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -1.6e-7: tmp = t_1 elif phi2 <= 1.35e-7: tmp = math.atan2(t_0, (-1.0 * (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -1.6e-7) tmp = t_1; elseif (phi2 <= 1.35e-7) tmp = atan(t_0, Float64(-1.0 * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((t_0 * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -1.6e-7) tmp = t_1; elseif (phi2 <= 1.35e-7) tmp = atan2(t_0, (-1.0 * (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.6e-7], t$95$1, If[LessEqual[phi2, 1.35e-7], N[ArcTan[t$95$0 / N[(-1.0 * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -1.6 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 1.35 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{-1 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.6e-7 or 1.35000000000000004e-7 < phi2 Initial program 76.8%
Taylor expanded in phi1 around 0
lift-sin.f6448.6
Applied rewrites48.6%
if -1.6e-7 < phi2 < 1.35000000000000004e-7Initial program 81.5%
lift--.f64N/A
lift-sin.f64N/A
sin-diffN/A
cos-negN/A
mul-1-negN/A
lower--.f64N/A
mul-1-negN/A
lower-*.f64N/A
lower-sin.f64N/A
cos-negN/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6489.0
Applied rewrites89.0%
lift--.f64N/A
lift-cos.f64N/A
cos-diffN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
sin-diff-revN/A
*-commutativeN/A
sin-diff-revN/A
lift-sin.f64N/A
lift--.f6481.7
Applied rewrites81.7%
Taylor expanded in phi2 around 0
cos-diff-revN/A
lower-*.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
cos-diff-revN/A
lower-cos.f64N/A
lift--.f6478.4
Applied rewrites78.4%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin lambda1) (cos phi2)) (sin phi2))))
(if (<= lambda1 -1.35e-78)
t_0
(if (<= lambda1 7e+41)
(atan2 (* (sin (- lambda2)) (cos phi2)) (sin phi2))
t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2((sin(lambda1) * cos(phi2)), sin(phi2));
double tmp;
if (lambda1 <= -1.35e-78) {
tmp = t_0;
} else if (lambda1 <= 7e+41) {
tmp = atan2((sin(-lambda2) * cos(phi2)), sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
real(8) :: tmp
t_0 = atan2((sin(lambda1) * cos(phi2)), sin(phi2))
if (lambda1 <= (-1.35d-78)) then
tmp = t_0
else if (lambda1 <= 7d+41) then
tmp = atan2((sin(-lambda2) * cos(phi2)), sin(phi2))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (lambda1 <= -1.35e-78) {
tmp = t_0;
} else if (lambda1 <= 7e+41) {
tmp = Math.atan2((Math.sin(-lambda2) * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2((math.sin(lambda1) * math.cos(phi2)), math.sin(phi2)) tmp = 0 if lambda1 <= -1.35e-78: tmp = t_0 elif lambda1 <= 7e+41: tmp = math.atan2((math.sin(-lambda2) * math.cos(phi2)), math.sin(phi2)) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(Float64(sin(lambda1) * cos(phi2)), sin(phi2)) tmp = 0.0 if (lambda1 <= -1.35e-78) tmp = t_0; elseif (lambda1 <= 7e+41) tmp = atan(Float64(sin(Float64(-lambda2)) * cos(phi2)), sin(phi2)); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2((sin(lambda1) * cos(phi2)), sin(phi2)); tmp = 0.0; if (lambda1 <= -1.35e-78) tmp = t_0; elseif (lambda1 <= 7e+41) tmp = atan2((sin(-lambda2) * cos(phi2)), sin(phi2)); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -1.35e-78], t$95$0, If[LessEqual[lambda1, 7e+41], N[ArcTan[N[(N[Sin[(-lambda2)], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\lambda_1 \leq -1.35 \cdot 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 7 \cdot 10^{+41}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(-\lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -1.34999999999999997e-78 or 6.9999999999999998e41 < lambda1 Initial program 63.3%
Taylor expanded in phi1 around 0
lift-sin.f6442.0
Applied rewrites42.0%
Taylor expanded in lambda1 around inf
Applied rewrites39.7%
if -1.34999999999999997e-78 < lambda1 < 6.9999999999999998e41Initial program 96.6%
Taylor expanded in phi1 around 0
lift-sin.f6456.9
Applied rewrites56.9%
Taylor expanded in lambda1 around 0
mul-1-negN/A
lower-neg.f6447.4
Applied rewrites47.4%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.66e-22) (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) phi2) (atan2 (* (sin lambda1) (cos phi2)) (sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2);
} else {
tmp = atan2((sin(lambda1) * cos(phi2)), sin(phi2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi2 <= 1.66d-22) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2)
else
tmp = atan2((sin(lambda1) * cos(phi2)), sin(phi2))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), phi2);
} else {
tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.66e-22: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), phi2) else: tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.66e-22) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan(Float64(sin(lambda1) * cos(phi2)), sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.66e-22) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan2((sin(lambda1) * cos(phi2)), sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.66e-22], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.66 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.65999999999999997e-22Initial program 80.2%
Taylor expanded in phi1 around 0
lift-sin.f6449.7
Applied rewrites49.7%
Taylor expanded in phi2 around 0
Applied rewrites41.3%
if 1.65999999999999997e-22 < phi2 Initial program 76.2%
Taylor expanded in phi1 around 0
lift-sin.f6447.3
Applied rewrites47.3%
Taylor expanded in lambda1 around inf
Applied rewrites28.5%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), sin(phi2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}
\end{array}
Initial program 79.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda1 lambda2)) (cos phi2))))
(if (<= phi2 -2.2)
(atan2 t_0 phi2)
(atan2 t_0 (* (fma (* phi2 phi2) -0.16666666666666666 1.0) phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (phi2 <= -2.2) {
tmp = atan2(t_0, phi2);
} else {
tmp = atan2(t_0, (fma((phi2 * phi2), -0.16666666666666666, 1.0) * phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (phi2 <= -2.2) tmp = atan(t_0, phi2); else tmp = atan(t_0, Float64(fma(Float64(phi2 * phi2), -0.16666666666666666, 1.0) * phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -2.2], N[ArcTan[t$95$0 / phi2], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_2 \leq -2.2:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\phi_2 \cdot \phi_2, -0.16666666666666666, 1\right) \cdot \phi_2}\\
\end{array}
\end{array}
if phi2 < -2.2000000000000002Initial program 77.2%
Taylor expanded in phi1 around 0
lift-sin.f6449.6
Applied rewrites49.6%
Taylor expanded in phi2 around 0
Applied rewrites24.9%
if -2.2000000000000002 < phi2 Initial program 79.7%
Taylor expanded in phi1 around 0
lift-sin.f6448.9
Applied rewrites48.9%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.3
Applied rewrites41.3%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.66e-22) (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) phi2) (atan2 (* (sin lambda1) 1.0) (sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2);
} else {
tmp = atan2((sin(lambda1) * 1.0), sin(phi2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi2 <= 1.66d-22) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2)
else
tmp = atan2((sin(lambda1) * 1.0d0), sin(phi2))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), phi2);
} else {
tmp = Math.atan2((Math.sin(lambda1) * 1.0), Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.66e-22: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), phi2) else: tmp = math.atan2((math.sin(lambda1) * 1.0), math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.66e-22) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan(Float64(sin(lambda1) * 1.0), sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.66e-22) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan2((sin(lambda1) * 1.0), sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.66e-22], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * 1.0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.66 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot 1}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.65999999999999997e-22Initial program 80.2%
Taylor expanded in phi1 around 0
lift-sin.f6449.7
Applied rewrites49.7%
Taylor expanded in phi2 around 0
Applied rewrites41.3%
if 1.65999999999999997e-22 < phi2 Initial program 76.2%
Taylor expanded in phi1 around 0
lift-sin.f6447.3
Applied rewrites47.3%
Taylor expanded in phi2 around 0
Applied rewrites15.9%
Taylor expanded in lambda1 around inf
Applied rewrites14.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 -0.00105)
(atan2 (* (cos phi2) (- (sin lambda2))) phi2)
(atan2
(* (sin (- lambda1 lambda2)) 1.0)
(* (fma (* phi2 phi2) -0.16666666666666666 1.0) phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -0.00105) {
tmp = atan2((cos(phi2) * -sin(lambda2)), phi2);
} else {
tmp = atan2((sin((lambda1 - lambda2)) * 1.0), (fma((phi2 * phi2), -0.16666666666666666, 1.0) * phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= -0.00105) tmp = atan(Float64(cos(phi2) * Float64(-sin(lambda2))), phi2); else tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * 1.0), Float64(fma(Float64(phi2 * phi2), -0.16666666666666666, 1.0) * phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -0.00105], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * (-N[Sin[lambda2], $MachinePrecision])), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] / N[(N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq -0.00105:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(-\sin \lambda_2\right)}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot 1}{\mathsf{fma}\left(\phi_2 \cdot \phi_2, -0.16666666666666666, 1\right) \cdot \phi_2}\\
\end{array}
\end{array}
if phi2 < -0.00104999999999999994Initial program 77.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.6
Applied rewrites49.6%
Taylor expanded in phi2 around 0
Applied rewrites15.1%
Taylor expanded in phi2 around 0
Applied rewrites15.0%
Taylor expanded in lambda1 around 0
sin-diff-revN/A
lower-*.f64N/A
lift-cos.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f6419.6
Applied rewrites19.6%
if -0.00104999999999999994 < phi2 Initial program 79.7%
Taylor expanded in phi1 around 0
lift-sin.f6448.9
Applied rewrites48.9%
Taylor expanded in phi2 around 0
Applied rewrites37.5%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6437.5
Applied rewrites37.5%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.66e-22) (atan2 (* (sin (- lambda1 lambda2)) 1.0) phi2) (atan2 (* (sin lambda1) 1.0) (sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = atan2((sin((lambda1 - lambda2)) * 1.0), phi2);
} else {
tmp = atan2((sin(lambda1) * 1.0), sin(phi2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi2 <= 1.66d-22) then
tmp = atan2((sin((lambda1 - lambda2)) * 1.0d0), phi2)
else
tmp = atan2((sin(lambda1) * 1.0d0), sin(phi2))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.66e-22) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * 1.0), phi2);
} else {
tmp = Math.atan2((Math.sin(lambda1) * 1.0), Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.66e-22: tmp = math.atan2((math.sin((lambda1 - lambda2)) * 1.0), phi2) else: tmp = math.atan2((math.sin(lambda1) * 1.0), math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.66e-22) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * 1.0), phi2); else tmp = atan(Float64(sin(lambda1) * 1.0), sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.66e-22) tmp = atan2((sin((lambda1 - lambda2)) * 1.0), phi2); else tmp = atan2((sin(lambda1) * 1.0), sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.66e-22], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * 1.0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.66 \cdot 10^{-22}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot 1}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot 1}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.65999999999999997e-22Initial program 80.2%
Taylor expanded in phi1 around 0
lift-sin.f6449.7
Applied rewrites49.7%
Taylor expanded in phi2 around 0
Applied rewrites37.8%
Taylor expanded in phi2 around 0
Applied rewrites37.8%
if 1.65999999999999997e-22 < phi2 Initial program 76.2%
Taylor expanded in phi1 around 0
lift-sin.f6447.3
Applied rewrites47.3%
Taylor expanded in phi2 around 0
Applied rewrites15.9%
Taylor expanded in lambda1 around inf
Applied rewrites14.0%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) 1.0) (sin phi2)))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * 1.0), sin(phi2));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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)) * 1.0d0), sin(phi2))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * 1.0), Math.sin(phi2));
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * 1.0), math.sin(phi2))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * 1.0), sin(phi2)) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * 1.0), sin(phi2)); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot 1}{\sin \phi_2}
\end{array}
Initial program 79.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in phi2 around 0
Applied rewrites31.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda1 lambda2)) 1.0)))
(if (<= phi2 4.5)
(atan2 t_0 phi2)
(atan2 t_0 (* (fma (* phi2 phi2) -0.16666666666666666 1.0) phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2)) * 1.0;
double tmp;
if (phi2 <= 4.5) {
tmp = atan2(t_0, phi2);
} else {
tmp = atan2(t_0, (fma((phi2 * phi2), -0.16666666666666666, 1.0) * phi2));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(lambda1 - lambda2)) * 1.0) tmp = 0.0 if (phi2 <= 4.5) tmp = atan(t_0, phi2); else tmp = atan(t_0, Float64(fma(Float64(phi2 * phi2), -0.16666666666666666, 1.0) * phi2)); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[phi2, 4.5], N[ArcTan[t$95$0 / phi2], $MachinePrecision], N[ArcTan[t$95$0 / N[(N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * phi2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right) \cdot 1\\
\mathbf{if}\;\phi_2 \leq 4.5:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\mathsf{fma}\left(\phi_2 \cdot \phi_2, -0.16666666666666666, 1\right) \cdot \phi_2}\\
\end{array}
\end{array}
if phi2 < 4.5Initial program 80.0%
Taylor expanded in phi1 around 0
lift-sin.f6449.6
Applied rewrites49.6%
Taylor expanded in phi2 around 0
Applied rewrites37.9%
Taylor expanded in phi2 around 0
Applied rewrites37.8%
if 4.5 < phi2 Initial program 76.4%
Taylor expanded in phi1 around 0
lift-sin.f6447.5
Applied rewrites47.5%
Taylor expanded in phi2 around 0
Applied rewrites14.1%
Taylor expanded in phi2 around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6414.2
Applied rewrites14.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) 1.0) phi2))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * 1.0), phi2);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
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)) * 1.0d0), phi2)
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((Math.sin((lambda1 - lambda2)) * 1.0), phi2);
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((math.sin((lambda1 - lambda2)) * 1.0), phi2)
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * 1.0), phi2) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((sin((lambda1 - lambda2)) * 1.0), phi2); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] / phi2], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot 1}{\phi_2}
\end{array}
Initial program 79.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in phi2 around 0
Applied rewrites31.9%
Taylor expanded in phi2 around 0
Applied rewrites29.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (- (sin lambda2)) 1.0) phi2))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((-sin(lambda2) * 1.0), phi2);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = atan2((-sin(lambda2) * 1.0d0), phi2)
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2((-Math.sin(lambda2) * 1.0), phi2);
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2((-math.sin(lambda2) * 1.0), phi2)
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(Float64(-sin(lambda2)) * 1.0), phi2) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2((-sin(lambda2) * 1.0), phi2); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[((-N[Sin[lambda2], $MachinePrecision]) * 1.0), $MachinePrecision] / phi2], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\left(-\sin \lambda_2\right) \cdot 1}{\phi_2}
\end{array}
Initial program 79.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in phi2 around 0
Applied rewrites31.9%
Taylor expanded in phi2 around 0
Applied rewrites29.2%
Taylor expanded in lambda1 around 0
sin-diff-revN/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f6422.2
Applied rewrites22.2%
herbie shell --seed 2025101
(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))))))