
(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 41 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
(*
(fma (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((fma(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(fma(sin(lambda1), cos(lambda2), Float64(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[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[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{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \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.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.f6489.6
Applied rewrites89.6%
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-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(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.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.f6489.6
Applied rewrites89.6%
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
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (- t_1 (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
(if (<= phi2 -0.0016)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
t_2)
(if (<= phi2 11500000000000.0)
(atan2
t_0
(-
t_1
(*
(sin phi1)
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2 t_0 t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2);
double t_1 = cos(phi1) * sin(phi2);
double t_2 = t_1 - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= -0.0016) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), t_2);
} else if (phi2 <= 11500000000000.0) {
tmp = atan2(t_0, (t_1 - (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2(t_0, t_2);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(t_1 - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= -0.0016) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), t_2); elseif (phi2 <= 11500000000000.0) tmp = atan(t_0, Float64(t_1 - Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(t_0, t_2); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -0.0016], 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] / t$95$2], $MachinePrecision], If[LessEqual[phi2, 11500000000000.0], N[ArcTan[t$95$0 / N[(t$95$1 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$0 / t$95$2], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := t\_1 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.0016:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_2}\\
\mathbf{elif}\;\phi_2 \leq 11500000000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_1 - \sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_2}\\
\end{array}
\end{array}
if phi2 < -0.00160000000000000008Initial program 76.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.f6489.9
Applied rewrites89.9%
if -0.00160000000000000008 < phi2 < 1.15e13Initial program 81.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.f6489.2
Applied rewrites89.2%
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%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in phi2 around 0
lift-sin.f6499.0
Applied rewrites99.0%
if 1.15e13 < phi2 Initial program 77.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.f6490.3
Applied rewrites90.3%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6490.3
Applied rewrites90.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (- t_0 (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2)))))
(t_2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))))
(if (<= phi2 -0.0016)
(atan2 t_2 t_1)
(if (<= phi2 11500000000000.0)
(atan2
t_2
(-
t_0
(*
(sin phi1)
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = t_0 - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)));
double t_2 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2);
double tmp;
if (phi2 <= -0.0016) {
tmp = atan2(t_2, t_1);
} else if (phi2 <= 11500000000000.0) {
tmp = atan2(t_2, (t_0 - (sin(phi1) * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), t_1);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(t_0 - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2)))) t_2 = Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)) tmp = 0.0 if (phi2 <= -0.0016) tmp = atan(t_2, t_1); elseif (phi2 <= 11500000000000.0) tmp = atan(t_2, Float64(t_0 - Float64(sin(phi1) * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), t_1); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[phi2, -0.0016], N[ArcTan[t$95$2 / t$95$1], $MachinePrecision], If[LessEqual[phi2, 11500000000000.0], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := t\_0 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
t_2 := \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\phi_2 \leq -0.0016:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_1}\\
\mathbf{elif}\;\phi_2 \leq 11500000000000:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_1}\\
\end{array}
\end{array}
if phi2 < -0.00160000000000000008Initial program 76.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.f6489.9
Applied rewrites89.9%
if -0.00160000000000000008 < phi2 < 1.15e13Initial program 81.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.f6489.2
Applied rewrites89.2%
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
lift-sin.f6499.0
Applied rewrites99.0%
if 1.15e13 < phi2 Initial program 77.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.f6490.3
Applied rewrites90.3%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6490.3
Applied rewrites90.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2)))
(t_1 (* (sin phi1) (cos phi2)))
(t_2 (- (* (cos phi1) (sin phi2)) (* t_1 (cos (- lambda1 lambda2))))))
(if (<= phi2 -0.00047)
(atan2 t_0 t_2)
(if (<= phi2 2e-30)
(atan2
t_0
(-
(sin phi2)
(*
t_1
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
t_2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = ((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2);
double t_1 = sin(phi1) * cos(phi2);
double t_2 = (cos(phi1) * sin(phi2)) - (t_1 * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= -0.00047) {
tmp = atan2(t_0, t_2);
} else if (phi2 <= 2e-30) {
tmp = atan2(t_0, (sin(phi2) - (t_1 * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), t_2);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)) t_1 = Float64(sin(phi1) * cos(phi2)) t_2 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_1 * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= -0.00047) tmp = atan(t_0, t_2); elseif (phi2 <= 2e-30) tmp = atan(t_0, Float64(sin(phi2) - Float64(t_1 * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), t_2); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = 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$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -0.00047], N[ArcTan[t$95$0 / t$95$2], $MachinePrecision], If[LessEqual[phi2, 2e-30], N[ArcTan[t$95$0 / N[(N[Sin[phi2], $MachinePrecision] - N[(t$95$1 * 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[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$2], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2\\
t_1 := \sin \phi_1 \cdot \cos \phi_2\\
t_2 := \cos \phi_1 \cdot \sin \phi_2 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -0.00047:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{t\_2}\\
\mathbf{elif}\;\phi_2 \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2 - t\_1 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_2}\\
\end{array}
\end{array}
if phi2 < -4.69999999999999986e-4Initial program 76.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.f6489.9
Applied rewrites89.9%
if -4.69999999999999986e-4 < phi2 < 2e-30Initial 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.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-30 < phi2 Initial program 77.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.f6490.2
Applied rewrites90.2%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6490.2
Applied rewrites90.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (- (cos lambda1)) (sin lambda2)))
(t_1 (* (cos phi1) (sin phi2)))
(t_2 (* (sin phi1) (cos phi2)))
(t_3 (- t_1 (* t_2 (cos (- lambda1 lambda2))))))
(if (<= phi2 -8.5e-5)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
t_3)
(if (<= phi2 2e-30)
(atan2
(fma (cos lambda2) (sin lambda1) t_0)
(-
t_1
(*
t_2
(fma (cos lambda1) (cos lambda2) (* (sin lambda1) (sin lambda2))))))
(atan2 (* (fma (sin lambda1) (cos lambda2) t_0) (cos phi2)) t_3)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -cos(lambda1) * sin(lambda2);
double t_1 = cos(phi1) * sin(phi2);
double t_2 = sin(phi1) * cos(phi2);
double t_3 = t_1 - (t_2 * cos((lambda1 - lambda2)));
double tmp;
if (phi2 <= -8.5e-5) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), t_3);
} else if (phi2 <= 2e-30) {
tmp = atan2(fma(cos(lambda2), sin(lambda1), t_0), (t_1 - (t_2 * fma(cos(lambda1), cos(lambda2), (sin(lambda1) * sin(lambda2))))));
} else {
tmp = atan2((fma(sin(lambda1), cos(lambda2), t_0) * cos(phi2)), t_3);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(-cos(lambda1)) * sin(lambda2)) t_1 = Float64(cos(phi1) * sin(phi2)) t_2 = Float64(sin(phi1) * cos(phi2)) t_3 = Float64(t_1 - Float64(t_2 * cos(Float64(lambda1 - lambda2)))) tmp = 0.0 if (phi2 <= -8.5e-5) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), t_3); elseif (phi2 <= 2e-30) tmp = atan(fma(cos(lambda2), sin(lambda1), t_0), Float64(t_1 - Float64(t_2 * fma(cos(lambda1), cos(lambda2), Float64(sin(lambda1) * sin(lambda2)))))); else tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), t_0) * cos(phi2)), t_3); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[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[(t$95$1 - N[(t$95$2 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -8.5e-5], 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] / t$95$3], $MachinePrecision], If[LessEqual[phi2, 2e-30], N[ArcTan[N[(N[Cos[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + t$95$0), $MachinePrecision] / N[(t$95$1 - N[(t$95$2 * 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[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$3], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := \sin \phi_1 \cdot \cos \phi_2\\
t_3 := t\_1 - t\_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_3}\\
\mathbf{elif}\;\phi_2 \leq 2 \cdot 10^{-30}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\cos \lambda_2, \sin \lambda_1, t\_0\right)}{t\_1 - t\_2 \cdot \mathsf{fma}\left(\cos \lambda_1, \cos \lambda_2, \sin \lambda_1 \cdot \sin \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, t\_0\right) \cdot \cos \phi_2}{t\_3}\\
\end{array}
\end{array}
if phi2 < -8.500000000000001e-5Initial program 76.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.f6489.9
Applied rewrites89.9%
if -8.500000000000001e-5 < phi2 < 2e-30Initial 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.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 phi2 around 0
sin-diff-revN/A
sin-+PI/2-revN/A
sin-mult-revN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if 2e-30 < phi2 Initial program 77.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.f6490.2
Applied rewrites90.2%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6490.2
Applied rewrites90.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (sin phi1) (cos phi2)))
(t_2
(atan2
(*
(fma
(sin lambda1)
(cos lambda2)
(* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
(- t_0 (* t_1 (cos lambda2))))))
(if (<= lambda2 -16500.0)
t_2
(if (<= lambda2 3.2e-9)
(atan2
(* (- (* (sin lambda1) (cos lambda2)) (sin lambda2)) (cos phi2))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))
t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin(phi1) * cos(phi2);
double t_2 = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (t_1 * cos(lambda2))));
double tmp;
if (lambda2 <= -16500.0) {
tmp = t_2;
} else if (lambda2 <= 3.2e-9) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - sin(lambda2)) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(sin(phi1) * cos(phi2)) t_2 = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(t_1 * cos(lambda2)))) tmp = 0.0 if (lambda2 <= -16500.0) tmp = t_2; elseif (lambda2 <= 3.2e-9) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - sin(lambda2)) * cos(phi2)), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); else tmp = t_2; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -16500.0], t$95$2, If[LessEqual[lambda2, 3.2e-9], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \phi_1 \cdot \cos \phi_2\\
t_2 := \tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - t\_1 \cdot \cos \lambda_2}\\
\mathbf{if}\;\lambda_2 \leq -16500:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\lambda_2 \leq 3.2 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if lambda2 < -16500 or 3.20000000000000012e-9 < lambda2 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.9
Applied rewrites79.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.7
Applied rewrites99.7%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in lambda1 around 0
cos-diff-revN/A
lift-cos.f6479.8
Applied rewrites79.8%
if -16500 < lambda2 < 3.20000000000000012e-9Initial program 99.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.f6499.5
Applied rewrites99.5%
Taylor expanded in lambda1 around 0
lift-sin.f6499.2
Applied rewrites99.2%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1 (* (sin phi1) (cos phi2)))
(t_2 (* (sin lambda1) (cos lambda2)))
(t_3
(atan2
(* (- t_2 (* (cos lambda1) (sin lambda2))) (cos phi2))
(- t_0 (* t_1 (cos lambda2))))))
(if (<= lambda2 -16500.0)
t_3
(if (<= lambda2 3.2e-9)
(atan2
(* (- t_2 (sin lambda2)) (cos phi2))
(- t_0 (* t_1 (cos (- lambda1 lambda2)))))
t_3))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = sin(phi1) * cos(phi2);
double t_2 = sin(lambda1) * cos(lambda2);
double t_3 = atan2(((t_2 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (t_1 * cos(lambda2))));
double tmp;
if (lambda2 <= -16500.0) {
tmp = t_3;
} else if (lambda2 <= 3.2e-9) {
tmp = atan2(((t_2 - sin(lambda2)) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))));
} else {
tmp = t_3;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = cos(phi1) * sin(phi2)
t_1 = sin(phi1) * cos(phi2)
t_2 = sin(lambda1) * cos(lambda2)
t_3 = atan2(((t_2 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (t_1 * cos(lambda2))))
if (lambda2 <= (-16500.0d0)) then
tmp = t_3
else if (lambda2 <= 3.2d-9) then
tmp = atan2(((t_2 - sin(lambda2)) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2)))))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.sin(phi1) * Math.cos(phi2);
double t_2 = Math.sin(lambda1) * Math.cos(lambda2);
double t_3 = Math.atan2(((t_2 - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (t_0 - (t_1 * Math.cos(lambda2))));
double tmp;
if (lambda2 <= -16500.0) {
tmp = t_3;
} else if (lambda2 <= 3.2e-9) {
tmp = Math.atan2(((t_2 - Math.sin(lambda2)) * Math.cos(phi2)), (t_0 - (t_1 * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_3;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.sin(phi1) * math.cos(phi2) t_2 = math.sin(lambda1) * math.cos(lambda2) t_3 = math.atan2(((t_2 - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (t_0 - (t_1 * math.cos(lambda2)))) tmp = 0 if lambda2 <= -16500.0: tmp = t_3 elif lambda2 <= 3.2e-9: tmp = math.atan2(((t_2 - math.sin(lambda2)) * math.cos(phi2)), (t_0 - (t_1 * math.cos((lambda1 - lambda2))))) else: tmp = t_3 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = Float64(sin(phi1) * cos(phi2)) t_2 = Float64(sin(lambda1) * cos(lambda2)) t_3 = atan(Float64(Float64(t_2 - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(t_0 - Float64(t_1 * cos(lambda2)))) tmp = 0.0 if (lambda2 <= -16500.0) tmp = t_3; elseif (lambda2 <= 3.2e-9) tmp = atan(Float64(Float64(t_2 - sin(lambda2)) * cos(phi2)), Float64(t_0 - Float64(t_1 * cos(Float64(lambda1 - lambda2))))); else tmp = t_3; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = sin(phi1) * cos(phi2); t_2 = sin(lambda1) * cos(lambda2); t_3 = atan2(((t_2 - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (t_0 - (t_1 * cos(lambda2)))); tmp = 0.0; if (lambda2 <= -16500.0) tmp = t_3; elseif (lambda2 <= 3.2e-9) tmp = atan2(((t_2 - sin(lambda2)) * cos(phi2)), (t_0 - (t_1 * cos((lambda1 - lambda2))))); else tmp = t_3; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[(t$95$2 - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -16500.0], t$95$3, If[LessEqual[lambda2, 3.2e-9], N[ArcTan[N[(N[(t$95$2 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(t$95$1 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \sin \phi_1 \cdot \cos \phi_2\\
t_2 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_3 := \tan^{-1}_* \frac{\left(t\_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - t\_1 \cdot \cos \lambda_2}\\
\mathbf{if}\;\lambda_2 \leq -16500:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\lambda_2 \leq 3.2 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(t\_2 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_0 - t\_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if lambda2 < -16500 or 3.20000000000000012e-9 < lambda2 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.9
Applied rewrites79.9%
Taylor expanded in lambda1 around 0
cos-neg-revN/A
lift-cos.f6479.8
Applied rewrites79.8%
if -16500 < lambda2 < 3.20000000000000012e-9Initial program 99.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.f6499.5
Applied rewrites99.5%
Taylor expanded in lambda1 around 0
lift-sin.f6499.2
Applied rewrites99.2%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (fma (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((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2))))) end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \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.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.f6489.6
Applied rewrites89.6%
lift--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6489.6
Applied rewrites89.6%
(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.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.f6489.6
Applied rewrites89.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_0))))
(if (<= phi1 -1.3e-5)
(atan2
(* (- (sin lambda1) (* (cos lambda1) (sin lambda2))) (cos phi2))
t_1)
(if (<= phi1 1.08e-11)
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
(- (sin phi2) (* 1.0 (* phi1 (* (cos phi2) t_0)))))
(atan2
(* (- (* (sin lambda1) (cos lambda2)) (sin lambda2)) (cos phi2))
t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = (cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0);
double tmp;
if (phi1 <= -1.3e-5) {
tmp = atan2(((sin(lambda1) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), t_1);
} else if (phi1 <= 1.08e-11) {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (1.0 * (phi1 * (cos(phi2) * t_0)))));
} else {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - sin(lambda2)) * cos(phi2)), t_1);
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0)) tmp = 0.0 if (phi1 <= -1.3e-5) tmp = atan(Float64(Float64(sin(lambda1) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), t_1); elseif (phi1 <= 1.08e-11) tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(1.0 * Float64(phi1 * Float64(cos(phi2) * t_0))))); else tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - sin(lambda2)) * cos(phi2)), t_1); end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(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]}, If[LessEqual[phi1, -1.3e-5], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision], If[LessEqual[phi1, 1.08e-11], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(1.0 * N[(phi1 * N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\\
\mathbf{if}\;\phi_1 \leq -1.3 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{t\_1}\\
\mathbf{elif}\;\phi_1 \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - 1 \cdot \left(\phi_1 \cdot \left(\cos \phi_2 \cdot t\_0\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_1}\\
\end{array}
\end{array}
if phi1 < -1.29999999999999992e-5Initial program 76.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.f6479.3
Applied rewrites79.3%
Taylor expanded in lambda2 around 0
lift-sin.f6477.4
Applied rewrites77.4%
if -1.29999999999999992e-5 < phi1 < 1.07999999999999992e-11Initial 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.f6499.6
Applied rewrites99.6%
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--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in phi1 around 0
cos-diff-revN/A
fp-cancel-sign-sub-invN/A
cos-diff-revN/A
lower--.f64N/A
lift-sin.f64N/A
metadata-evalN/A
Applied rewrites99.6%
if 1.07999999999999992e-11 < phi1 Initial program 77.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.f6480.2
Applied rewrites80.2%
Taylor expanded in lambda1 around 0
lift-sin.f6478.1
Applied rewrites78.1%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1
(atan2
(* (- (sin lambda1) (* (cos lambda1) (sin lambda2))) (cos phi2))
(- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_0)))))
(if (<= phi1 -1.3e-5)
t_1
(if (<= phi1 1.08e-11)
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
(- (sin phi2) (* 1.0 (* phi1 (* (cos phi2) t_0)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = atan2(((sin(lambda1) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0)));
double tmp;
if (phi1 <= -1.3e-5) {
tmp = t_1;
} else if (phi1 <= 1.08e-11) {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (1.0 * (phi1 * (cos(phi2) * t_0)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = atan(Float64(Float64(sin(lambda1) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0))) tmp = 0.0 if (phi1 <= -1.3e-5) tmp = t_1; elseif (phi1 <= 1.08e-11) tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(1.0 * Float64(phi1 * Float64(cos(phi2) * t_0))))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[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, -1.3e-5], t$95$1, If[LessEqual[phi1, 1.08e-11], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(1.0 * N[(phi1 * N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\left(\sin \lambda_1 - \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 t\_0}\\
\mathbf{if}\;\phi_1 \leq -1.3 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - 1 \cdot \left(\phi_1 \cdot \left(\cos \phi_2 \cdot t\_0\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -1.29999999999999992e-5 or 1.07999999999999992e-11 < phi1 Initial program 76.8%
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 lambda2 around 0
lift-sin.f6477.9
Applied rewrites77.9%
if -1.29999999999999992e-5 < phi1 < 1.07999999999999992e-11Initial 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.f6499.6
Applied rewrites99.6%
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--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in phi1 around 0
cos-diff-revN/A
fp-cancel-sign-sub-invN/A
cos-diff-revN/A
lower--.f64N/A
lift-sin.f64N/A
metadata-evalN/A
Applied rewrites99.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2))) (t_1 (cos (- lambda1 lambda2))))
(if (<= phi1 -5.8e-6)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma (sin phi2) (cos phi1) (* (- t_0) t_1)))
(if (<= phi1 1.08e-11)
(atan2
(*
(fma (sin lambda1) (cos lambda2) (* (- (cos lambda1)) (sin lambda2)))
(cos phi2))
(- (sin phi2) (* 1.0 (* phi1 (* (cos phi2) t_1)))))
(atan2
(* (- (sin lambda1) (sin lambda2)) (cos phi2))
(- (* (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 tmp;
if (phi1 <= -5.8e-6) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), (-t_0 * t_1)));
} else if (phi1 <= 1.08e-11) {
tmp = atan2((fma(sin(lambda1), cos(lambda2), (-cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (1.0 * (phi1 * (cos(phi2) * t_1)))));
} else {
tmp = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), ((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)) tmp = 0.0 if (phi1 <= -5.8e-6) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * t_1))); elseif (phi1 <= 1.08e-11) tmp = atan(Float64(fma(sin(lambda1), cos(lambda2), Float64(Float64(-cos(lambda1)) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(1.0 * Float64(phi1 * Float64(cos(phi2) * t_1))))); else tmp = atan(Float64(Float64(sin(lambda1) - sin(lambda2)) * cos(phi2)), 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]}, If[LessEqual[phi1, -5.8e-6], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-t$95$0) * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.08e-11], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] - N[(1.0 * N[(phi1 * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / 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)\\
\mathbf{if}\;\phi_1 \leq -5.8 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-t\_0\right) \cdot t\_1\right)}\\
\mathbf{elif}\;\phi_1 \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \left(-\cos \lambda_1\right) \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2 - 1 \cdot \left(\phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -5.8000000000000004e-6Initial program 76.4%
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.4%
if -5.8000000000000004e-6 < phi1 < 1.07999999999999992e-11Initial 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.f6499.6
Applied rewrites99.6%
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--.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in phi1 around 0
cos-diff-revN/A
fp-cancel-sign-sub-invN/A
cos-diff-revN/A
lower--.f64N/A
lift-sin.f64N/A
metadata-evalN/A
Applied rewrites99.6%
if 1.07999999999999992e-11 < phi1 Initial program 77.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.f6480.2
Applied rewrites80.2%
Taylor expanded in lambda2 around 0
lift-sin.f6478.3
Applied rewrites78.3%
Taylor expanded in lambda1 around 0
lift-sin.f6477.3
Applied rewrites77.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2))) (t_1 (cos (- lambda1 lambda2))))
(if (<= phi1 -5.8e-6)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(fma (sin phi2) (cos phi1) (* (- t_0) t_1)))
(if (<= phi1 1.08e-11)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (sin phi2) (* 1.0 (* phi1 (* (cos phi2) t_1)))))
(atan2
(* (- (sin lambda1) (sin lambda2)) (cos phi2))
(- (* (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 tmp;
if (phi1 <= -5.8e-6) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), (-t_0 * t_1)));
} else if (phi1 <= 1.08e-11) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (sin(phi2) - (1.0 * (phi1 * (cos(phi2) * t_1)))));
} else {
tmp = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), ((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)) tmp = 0.0 if (phi1 <= -5.8e-6) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * t_1))); elseif (phi1 <= 1.08e-11) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(sin(phi2) - Float64(1.0 * Float64(phi1 * Float64(cos(phi2) * t_1))))); else tmp = atan(Float64(Float64(sin(lambda1) - sin(lambda2)) * cos(phi2)), 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]}, If[LessEqual[phi1, -5.8e-6], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-t$95$0) * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.08e-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[Sin[phi2], $MachinePrecision] - N[(1.0 * N[(phi1 * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / 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)\\
\mathbf{if}\;\phi_1 \leq -5.8 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-t\_0\right) \cdot t\_1\right)}\\
\mathbf{elif}\;\phi_1 \leq 1.08 \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}{\sin \phi_2 - 1 \cdot \left(\phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot t\_1}\\
\end{array}
\end{array}
if phi1 < -5.8000000000000004e-6Initial program 76.4%
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.4%
if -5.8000000000000004e-6 < phi1 < 1.07999999999999992e-11Initial 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.f6499.6
Applied rewrites99.6%
Taylor expanded in phi1 around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-sin.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lift--.f6499.6
Applied rewrites99.6%
if 1.07999999999999992e-11 < phi1 Initial program 77.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.f6480.2
Applied rewrites80.2%
Taylor expanded in lambda2 around 0
lift-sin.f6478.3
Applied rewrites78.3%
Taylor expanded in lambda1 around 0
lift-sin.f6477.3
Applied rewrites77.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1
(atan2
(* (- (sin lambda1) (sin lambda2)) (cos phi2))
(- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_0)))))
(if (<= phi2 -8.5e-5)
t_1
(if (<= phi2 60000000000.0)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(- (* phi2 (cos phi1)) (* t_0 (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0)));
double tmp;
if (phi2 <= -8.5e-5) {
tmp = t_1;
} else if (phi2 <= 60000000000.0) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((phi2 * cos(phi1)) - (t_0 * 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 = cos((lambda1 - lambda2))
t_1 = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0)))
if (phi2 <= (-8.5d-5)) then
tmp = t_1
else if (phi2 <= 60000000000.0d0) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((phi2 * cos(phi1)) - (t_0 * sin(phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = Math.atan2(((Math.sin(lambda1) - Math.sin(lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * t_0)));
double tmp;
if (phi2 <= -8.5e-5) {
tmp = t_1;
} else if (phi2 <= 60000000000.0) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), ((phi2 * Math.cos(phi1)) - (t_0 * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = math.atan2(((math.sin(lambda1) - math.sin(lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * t_0))) tmp = 0 if phi2 <= -8.5e-5: tmp = t_1 elif phi2 <= 60000000000.0: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), ((phi2 * math.cos(phi1)) - (t_0 * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = atan(Float64(Float64(sin(lambda1) - sin(lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0))) tmp = 0.0 if (phi2 <= -8.5e-5) tmp = t_1; elseif (phi2 <= 60000000000.0) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(Float64(phi2 * cos(phi1)) - Float64(t_0 * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)); t_1 = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0))); tmp = 0.0; if (phi2 <= -8.5e-5) tmp = t_1; elseif (phi2 <= 60000000000.0) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((phi2 * cos(phi1)) - (t_0 * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[Sin[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] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -8.5e-5], t$95$1, If[LessEqual[phi2, 60000000000.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[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\left(\sin \lambda_1 - \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 t\_0}\\
\mathbf{if}\;\phi_2 \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 60000000000:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\phi_2 \cdot \cos \phi_1 - t\_0 \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -8.500000000000001e-5 or 6e10 < phi2 Initial program 76.8%
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.f6490.1
Applied rewrites90.1%
Taylor expanded in lambda2 around 0
lift-sin.f6478.0
Applied rewrites78.0%
Taylor expanded in lambda1 around 0
lift-sin.f6476.6
Applied rewrites76.6%
if -8.500000000000001e-5 < phi2 < 6e10Initial program 81.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.f6489.1
Applied rewrites89.1%
Taylor expanded in phi2 around 0
lower--.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6487.6
Applied rewrites87.6%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1 (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) t_0))))
(if (<= phi2 -4.8e-57)
(atan2 (* (- (sin lambda1) (sin lambda2)) (cos phi2)) t_1)
(if (<= phi2 1.55e-29)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(* -1.0 (* t_0 (sin phi1))))
(atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) t_1)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = (cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0);
double tmp;
if (phi2 <= -4.8e-57) {
tmp = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), t_1);
} else if (phi2 <= 1.55e-29) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (-1.0 * (t_0 * sin(phi1))));
} else {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), 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 = cos((lambda1 - lambda2))
t_1 = (cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0)
if (phi2 <= (-4.8d-57)) then
tmp = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), t_1)
else if (phi2 <= 1.55d-29) then
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), ((-1.0d0) * (t_0 * sin(phi1))))
else
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), t_1)
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((lambda1 - lambda2));
double t_1 = (Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * t_0);
double tmp;
if (phi2 <= -4.8e-57) {
tmp = Math.atan2(((Math.sin(lambda1) - Math.sin(lambda2)) * Math.cos(phi2)), t_1);
} else if (phi2 <= 1.55e-29) {
tmp = Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (-1.0 * (t_0 * Math.sin(phi1))));
} else {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), t_1);
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos((lambda1 - lambda2)) t_1 = (math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * t_0) tmp = 0 if phi2 <= -4.8e-57: tmp = math.atan2(((math.sin(lambda1) - math.sin(lambda2)) * math.cos(phi2)), t_1) elif phi2 <= 1.55e-29: tmp = math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (-1.0 * (t_0 * math.sin(phi1)))) else: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), t_1) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * t_0)) tmp = 0.0 if (phi2 <= -4.8e-57) tmp = atan(Float64(Float64(sin(lambda1) - sin(lambda2)) * cos(phi2)), t_1); elseif (phi2 <= 1.55e-29) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(-1.0 * Float64(t_0 * sin(phi1)))); else tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), t_1); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos((lambda1 - lambda2)); t_1 = (cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * t_0); tmp = 0.0; if (phi2 <= -4.8e-57) tmp = atan2(((sin(lambda1) - sin(lambda2)) * cos(phi2)), t_1); elseif (phi2 <= 1.55e-29) tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (-1.0 * (t_0 * sin(phi1)))); else tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), t_1); 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[(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]}, If[LessEqual[phi2, -4.8e-57], N[ArcTan[N[(N[(N[Sin[lambda1], $MachinePrecision] - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision], If[LessEqual[phi2, 1.55e-29], 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[(-1.0 * N[(t$95$0 * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\\
\mathbf{if}\;\phi_2 \leq -4.8 \cdot 10^{-57}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 - \sin \lambda_2\right) \cdot \cos \phi_2}{t\_1}\\
\mathbf{elif}\;\phi_2 \leq 1.55 \cdot 10^{-29}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{-1 \cdot \left(t\_0 \cdot \sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_1}\\
\end{array}
\end{array}
if phi2 < -4.80000000000000012e-57Initial program 76.6%
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.4
Applied rewrites89.4%
Taylor expanded in lambda2 around 0
lift-sin.f6478.3
Applied rewrites78.3%
Taylor expanded in lambda1 around 0
lift-sin.f6476.4
Applied rewrites76.4%
if -4.80000000000000012e-57 < phi2 < 1.55000000000000013e-29Initial program 81.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.f6489.4
Applied rewrites89.4%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6487.8
Applied rewrites87.8%
if 1.55000000000000013e-29 < phi2 Initial program 77.3%
(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 (<= phi2 -3.9e-58)
(atan2 t_2 (fma (sin phi2) (cos phi1) (* (- t_0) t_1)))
(if (<= phi2 1.55e-29)
(atan2
(*
(- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
(cos phi2))
(* -1.0 (* t_1 (sin phi1))))
(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 (phi2 <= -3.9e-58) {
tmp = atan2(t_2, fma(sin(phi2), cos(phi1), (-t_0 * t_1)));
} else if (phi2 <= 1.55e-29) {
tmp = atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (-1.0 * (t_1 * sin(phi1))));
} 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 (phi2 <= -3.9e-58) tmp = atan(t_2, fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * t_1))); elseif (phi2 <= 1.55e-29) tmp = atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(-1.0 * Float64(t_1 * sin(phi1)))); 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[phi2, -3.9e-58], 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[phi2, 1.55e-29], 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[(-1.0 * N[(t$95$1 * N[Sin[phi1], $MachinePrecision]), $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_2 \leq -3.9 \cdot 10^{-58}:\\
\;\;\;\;\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_2 \leq 1.55 \cdot 10^{-29}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{-1 \cdot \left(t\_1 \cdot \sin \phi_1\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 phi2 < -3.89999999999999992e-58Initial program 76.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
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.6%
if -3.89999999999999992e-58 < phi2 < 1.55000000000000013e-29Initial program 81.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.f6489.4
Applied rewrites89.4%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6487.8
Applied rewrites87.8%
if 1.55000000000000013e-29 < phi2 Initial program 77.3%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin phi1) (cos phi2)))
(t_1 (* (sin (- lambda1 lambda2)) (cos phi2))))
(if (<= lambda1 -1.25e-5)
(atan2 t_1 (fma (sin phi2) (cos phi1) (* (- (cos lambda1)) t_0)))
(if (<= lambda1 0.14)
(atan2 t_1 (- (* (cos phi1) (sin phi2)) (* t_0 (cos lambda2))))
(atan2
(* (sin lambda1) (cos phi2))
(fma (sin phi2) (cos phi1) (* (- t_0) (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin(phi1) * cos(phi2);
double t_1 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (lambda1 <= -1.25e-5) {
tmp = atan2(t_1, fma(sin(phi2), cos(phi1), (-cos(lambda1) * t_0)));
} else if (lambda1 <= 0.14) {
tmp = atan2(t_1, ((cos(phi1) * sin(phi2)) - (t_0 * cos(lambda2))));
} else {
tmp = atan2((sin(lambda1) * cos(phi2)), fma(sin(phi2), cos(phi1), (-t_0 * cos((lambda1 - lambda2)))));
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(phi1) * cos(phi2)) t_1 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (lambda1 <= -1.25e-5) tmp = atan(t_1, fma(sin(phi2), cos(phi1), Float64(Float64(-cos(lambda1)) * t_0))); elseif (lambda1 <= 0.14) tmp = atan(t_1, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(t_0 * cos(lambda2)))); else tmp = atan(Float64(sin(lambda1) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-t_0) * cos(Float64(lambda1 - lambda2))))); 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[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -1.25e-5], N[ArcTan[t$95$1 / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-N[Cos[lambda1], $MachinePrecision]) * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.14], N[ArcTan[t$95$1 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-t$95$0) * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\\
\mathbf{if}\;\lambda_1 \leq -1.25 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\cos \lambda_1\right) \cdot t\_0\right)}\\
\mathbf{elif}\;\lambda_1 \leq 0.14:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 \cdot \sin \phi_2 - t\_0 \cdot \cos \lambda_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-t\_0\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
\end{array}
\end{array}
if lambda1 < -1.25000000000000006e-5Initial program 59.1%
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-*.f6458.9
Applied rewrites58.9%
if -1.25000000000000006e-5 < lambda1 < 0.14000000000000001Initial program 99.1%
Taylor expanded in lambda1 around 0
cos-negN/A
lower-cos.f6499.1
Applied rewrites99.1%
if 0.14000000000000001 < lambda1 Initial program 60.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
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 rewrites60.6%
Taylor expanded in lambda1 around inf
Applied rewrites60.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (sin (- lambda1 lambda2)) (cos phi2)))
(t_1
(atan2
t_0
(-
(* (cos phi1) (sin phi2))
(* (sin phi1) (cos (- lambda1 lambda2)))))))
(if (<= lambda2 -5.7e+87)
t_1
(if (<= lambda2 1.15e-5)
(atan2
t_0
(fma
(sin phi2)
(cos phi1)
(* (- (cos lambda1)) (* (sin phi1) (cos 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(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
double tmp;
if (lambda2 <= -5.7e+87) {
tmp = t_1;
} else if (lambda2 <= 1.15e-5) {
tmp = atan2(t_0, fma(sin(phi2), cos(phi1), (-cos(lambda1) * (sin(phi1) * cos(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(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))) tmp = 0.0 if (lambda2 <= -5.7e+87) tmp = t_1; elseif (lambda2 <= 1.15e-5) tmp = atan(t_0, fma(sin(phi2), cos(phi1), Float64(Float64(-cos(lambda1)) * Float64(sin(phi1) * cos(phi2))))); else tmp = t_1; 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]}, Block[{t$95$1 = N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda2, -5.7e+87], t$95$1, If[LessEqual[lambda2, 1.15e-5], N[ArcTan[t$95$0 / 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], 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 \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{if}\;\lambda_2 \leq -5.7 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_2 \leq 1.15 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\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{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda2 < -5.70000000000000039e87 or 1.15e-5 < lambda2 Initial program 59.4%
Taylor expanded in phi2 around 0
lift-sin.f6449.5
Applied rewrites49.5%
if -5.70000000000000039e87 < lambda2 < 1.15e-5Initial program 94.4%
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-*.f6492.0
Applied rewrites92.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (- lambda1 lambda2)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(fma (sin phi2) (cos phi1) (* (- (* (sin phi1) (cos phi2))) t_0)))))
(if (<= lambda1 -3.9e-7)
t_1
(if (<= lambda1 2200000000000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- (* (cos phi1) (sin phi2)) (* (sin phi1) t_0)))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((lambda1 - lambda2));
double t_1 = atan2((sin(lambda1) * cos(phi2)), fma(sin(phi2), cos(phi1), (-(sin(phi1) * cos(phi2)) * t_0)));
double tmp;
if (lambda1 <= -3.9e-7) {
tmp = t_1;
} else if (lambda1 <= 2200000000000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (sin(phi1) * t_0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(lambda1 - lambda2)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-Float64(sin(phi1) * cos(phi2))) * t_0))) tmp = 0.0 if (lambda1 <= -3.9e-7) tmp = t_1; elseif (lambda1 <= 2200000000000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * t_0))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision] + N[((-N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]) * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -3.9e-7], t$95$1, If[LessEqual[lambda1, 2200000000000.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[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\sin \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)}\\
\mathbf{if}\;\lambda_1 \leq -3.9 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 2200000000000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -3.90000000000000025e-7 or 2.2e12 < lambda1 Initial program 59.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 rewrites59.7%
Taylor expanded in lambda1 around inf
Applied rewrites59.6%
if -3.90000000000000025e-7 < lambda1 < 2.2e12Initial program 98.5%
Taylor expanded in phi2 around 0
lift-sin.f6481.8
Applied rewrites81.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* (cos phi1) (sin phi2)))
(t_1
(atan2
(* (sin lambda1) (cos phi2))
(- t_0 (* (* (sin phi1) (cos phi2)) (cos lambda1))))))
(if (<= lambda1 -3.9e-7)
t_1
(if (<= lambda1 2200000000000.0)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(- t_0 (* (sin phi1) (cos (- lambda1 lambda2)))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos(phi1) * sin(phi2);
double t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((sin(phi1) * cos(phi2)) * cos(lambda1))));
double tmp;
if (lambda1 <= -3.9e-7) {
tmp = t_1;
} else if (lambda1 <= 2200000000000.0) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_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 = cos(phi1) * sin(phi2)
t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((sin(phi1) * cos(phi2)) * cos(lambda1))))
if (lambda1 <= (-3.9d-7)) then
tmp = t_1
else if (lambda1 <= 2200000000000.0d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_0 - (sin(phi1) * cos((lambda1 - lambda2)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos(phi1) * Math.sin(phi2);
double t_1 = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos(lambda1))));
double tmp;
if (lambda1 <= -3.9e-7) {
tmp = t_1;
} else if (lambda1 <= 2200000000000.0) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (t_0 - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.cos(phi1) * math.sin(phi2) t_1 = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - ((math.sin(phi1) * math.cos(phi2)) * math.cos(lambda1)))) tmp = 0 if lambda1 <= -3.9e-7: tmp = t_1 elif lambda1 <= 2200000000000.0: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (t_0 - (math.sin(phi1) * math.cos((lambda1 - lambda2))))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(cos(phi1) * sin(phi2)) t_1 = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(Float64(sin(phi1) * cos(phi2)) * cos(lambda1)))) tmp = 0.0 if (lambda1 <= -3.9e-7) tmp = t_1; elseif (lambda1 <= 2200000000000.0) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = cos(phi1) * sin(phi2); t_1 = atan2((sin(lambda1) * cos(phi2)), (t_0 - ((sin(phi1) * cos(phi2)) * cos(lambda1)))); tmp = 0.0; if (lambda1 <= -3.9e-7) tmp = t_1; elseif (lambda1 <= 2200000000000.0) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (t_0 - (sin(phi1) * cos((lambda1 - lambda2))))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -3.9e-7], t$95$1, If[LessEqual[lambda1, 2200000000000.0], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \lambda_1}\\
\mathbf{if}\;\lambda_1 \leq -3.9 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\lambda_1 \leq 2200000000000:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if lambda1 < -3.90000000000000025e-7 or 2.2e12 < lambda1 Initial program 59.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.f6480.2
Applied rewrites80.2%
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%
Taylor expanded in lambda2 around 0
sin-diff-revN/A
lift-sin.f6460.0
Applied rewrites60.0%
Taylor expanded in lambda2 around 0
cos-diff-revN/A
lift-cos.f6459.6
Applied rewrites59.6%
if -3.90000000000000025e-7 < lambda1 < 2.2e12Initial program 98.5%
Taylor expanded in phi2 around 0
lift-sin.f6481.8
Applied rewrites81.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (fma (sin phi2) (cos phi1) (* (- (* (sin phi1) (cos phi2))) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2((sin((lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), (-(sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), fma(sin(phi2), cos(phi1), Float64(Float64(-Float64(sin(phi1) * cos(phi2))) * cos(Float64(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[Sin[phi2], $MachinePrecision] * N[Cos[phi1], $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}{\mathsf{fma}\left(\sin \phi_2, \cos \phi_1, \left(-\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}
\end{array}
Initial program 79.0%
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 rewrites79.0%
(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}
Initial program 79.0%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (sin phi1) (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((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((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((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((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2) return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * 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((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[Sin[phi1], $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 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Initial program 79.0%
Taylor expanded in phi2 around 0
lift-sin.f6465.8
Applied rewrites65.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (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)), (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)), (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.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.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(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)), (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[Sin[phi2], $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}{\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.0%
Taylor expanded in phi1 around 0
lift-sin.f6465.6
Applied rewrites65.6%
(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 -2.05e-12)
t_2
(if (<= phi1 1.08e-11)
(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 <= -2.05e-12) {
tmp = t_2;
} else if (phi1 <= 1.08e-11) {
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 <= -2.05e-12) tmp = t_2; elseif (phi1 <= 1.08e-11) 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, -2.05e-12], t$95$2, If[LessEqual[phi1, 1.08e-11], 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 -2.05 \cdot 10^{-12}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\phi_1 \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\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 < -2.04999999999999995e-12 or 1.07999999999999992e-11 < phi1 Initial program 76.6%
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.04999999999999995e-12 < phi1 < 1.07999999999999992e-11Initial program 81.5%
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.5
Applied rewrites81.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.02e-26)
t_1
(if (<= phi2 3.4e-7)
(atan2
(*
t_0
(fma
(- (* (* phi2 phi2) 0.041666666666666664) 0.5)
(* phi2 phi2)
1.0))
(- (* phi2 (cos phi1)) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -1.02e-26) {
tmp = t_1;
} else if (phi2 <= 3.4e-7) {
tmp = atan2((t_0 * fma((((phi2 * phi2) * 0.041666666666666664) - 0.5), (phi2 * phi2), 1.0)), ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -1.02e-26) tmp = t_1; elseif (phi2 <= 3.4e-7) tmp = atan(Float64(t_0 * fma(Float64(Float64(Float64(phi2 * phi2) * 0.041666666666666664) - 0.5), Float64(phi2 * phi2), 1.0)), Float64(Float64(phi2 * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end return tmp end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.02e-26], t$95$1, If[LessEqual[phi2, 3.4e-7], N[ArcTan[N[(t$95$0 * N[(N[(N[(N[(phi2 * phi2), $MachinePrecision] * 0.041666666666666664), $MachinePrecision] - 0.5), $MachinePrecision] * N[(phi2 * phi2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -1.02 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 3.4 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0 \cdot \mathsf{fma}\left(\left(\phi_2 \cdot \phi_2\right) \cdot 0.041666666666666664 - 0.5, \phi_2 \cdot \phi_2, 1\right)}{\phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.02e-26 or 3.39999999999999974e-7 < phi2 Initial program 76.7%
Taylor expanded in phi1 around 0
lift-sin.f6448.7
Applied rewrites48.7%
if -1.02e-26 < phi2 < 3.39999999999999974e-7Initial program 81.7%
Taylor expanded in phi2 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
Taylor expanded in phi2 around 0
lower--.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6481.7
Applied rewrites81.7%
(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.02e-26)
t_1
(if (<= phi2 3.4e-7)
(atan2
t_0
(- (* phi2 (cos phi1)) (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -1.02e-26) {
tmp = t_1;
} else if (phi2 <= 3.4e-7) {
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (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))
t_1 = atan2((t_0 * cos(phi2)), sin(phi2))
if (phi2 <= (-1.02d-26)) then
tmp = t_1
else if (phi2 <= 3.4d-7) then
tmp = atan2(t_0, ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * sin(phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((t_0 * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -1.02e-26) {
tmp = t_1;
} else if (phi2 <= 3.4e-7) {
tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((t_0 * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -1.02e-26: tmp = t_1 elif phi2 <= 3.4e-7: tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -1.02e-26) tmp = t_1; elseif (phi2 <= 3.4e-7) tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((t_0 * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -1.02e-26) tmp = t_1; elseif (phi2 <= 3.4e-7) tmp = atan2(t_0, ((phi2 * cos(phi1)) - (cos((lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.02e-26], t$95$1, If[LessEqual[phi2, 3.4e-7], N[ArcTan[t$95$0 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -1.02 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 3.4 \cdot 10^{-7}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.02e-26 or 3.39999999999999974e-7 < phi2 Initial program 76.7%
Taylor expanded in phi1 around 0
lift-sin.f6448.7
Applied rewrites48.7%
if -1.02e-26 < phi2 < 3.39999999999999974e-7Initial program 81.7%
Taylor expanded in phi1 around 0
lift-sin.f6449.5
Applied rewrites49.5%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in phi2 around 0
lower--.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6481.7
Applied rewrites81.7%
(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 -3.6e-25)
t_1
(if (<= phi1 6.8e-12) (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 <= -3.6e-25) {
tmp = t_1;
} else if (phi1 <= 6.8e-12) {
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 <= (-3.6d-25)) then
tmp = t_1
else if (phi1 <= 6.8d-12) 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 <= -3.6e-25) {
tmp = t_1;
} else if (phi1 <= 6.8e-12) {
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 <= -3.6e-25: tmp = t_1 elif phi1 <= 6.8e-12: 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 <= -3.6e-25) tmp = t_1; elseif (phi1 <= 6.8e-12) 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 <= -3.6e-25) tmp = t_1; elseif (phi1 <= 6.8e-12) 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, -3.6e-25], t$95$1, If[LessEqual[phi1, 6.8e-12], 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 -3.6 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_1 \leq 6.8 \cdot 10^{-12}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi1 < -3.5999999999999999e-25 or 6.8000000000000001e-12 < phi1 Initial program 76.7%
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 -3.5999999999999999e-25 < phi1 < 6.8000000000000001e-12Initial program 81.5%
Taylor expanded in phi1 around 0
lift-sin.f6479.2
Applied rewrites79.2%
(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.02e-26)
t_1
(if (<= phi2 1.7e-9)
(atan2 t_0 (* -1.0 (* (cos (- lambda1 lambda2)) (sin phi1))))
t_1))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2));
double t_1 = atan2((t_0 * cos(phi2)), sin(phi2));
double tmp;
if (phi2 <= -1.02e-26) {
tmp = t_1;
} else if (phi2 <= 1.7e-9) {
tmp = atan2(t_0, (-1.0 * (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))
t_1 = atan2((t_0 * cos(phi2)), sin(phi2))
if (phi2 <= (-1.02d-26)) then
tmp = t_1
else if (phi2 <= 1.7d-9) then
tmp = atan2(t_0, ((-1.0d0) * (cos((lambda1 - lambda2)) * sin(phi1))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.sin((lambda1 - lambda2));
double t_1 = Math.atan2((t_0 * Math.cos(phi2)), Math.sin(phi2));
double tmp;
if (phi2 <= -1.02e-26) {
tmp = t_1;
} else if (phi2 <= 1.7e-9) {
tmp = Math.atan2(t_0, (-1.0 * (Math.cos((lambda1 - lambda2)) * Math.sin(phi1))));
} else {
tmp = t_1;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) t_1 = math.atan2((t_0 * math.cos(phi2)), math.sin(phi2)) tmp = 0 if phi2 <= -1.02e-26: tmp = t_1 elif phi2 <= 1.7e-9: tmp = math.atan2(t_0, (-1.0 * (math.cos((lambda1 - lambda2)) * math.sin(phi1)))) else: tmp = t_1 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = sin(Float64(lambda1 - lambda2)) t_1 = atan(Float64(t_0 * cos(phi2)), sin(phi2)) tmp = 0.0 if (phi2 <= -1.02e-26) tmp = t_1; elseif (phi2 <= 1.7e-9) tmp = atan(t_0, Float64(-1.0 * Float64(cos(Float64(lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)); t_1 = atan2((t_0 * cos(phi2)), sin(phi2)); tmp = 0.0; if (phi2 <= -1.02e-26) tmp = t_1; elseif (phi2 <= 1.7e-9) tmp = atan2(t_0, (-1.0 * (cos((lambda1 - lambda2)) * sin(phi1)))); else tmp = t_1; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.02e-26], t$95$1, If[LessEqual[phi2, 1.7e-9], N[ArcTan[t$95$0 / N[(-1.0 * N[(N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \tan^{-1}_* \frac{t\_0 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{if}\;\phi_2 \leq -1.02 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{-1 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if phi2 < -1.02e-26 or 1.6999999999999999e-9 < phi2 Initial program 76.7%
Taylor expanded in phi1 around 0
lift-sin.f6448.7
Applied rewrites48.7%
if -1.02e-26 < phi2 < 1.6999999999999999e-9Initial program 81.7%
Taylor expanded in phi1 around 0
lift-sin.f6449.5
Applied rewrites49.5%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift--.f64N/A
lift-sin.f6479.5
Applied rewrites79.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin lambda1) (cos phi2)) (sin phi2))))
(if (<= lambda1 -6.6e-85)
t_0
(if (<= lambda1 1.7e-23)
(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 <= -6.6e-85) {
tmp = t_0;
} else if (lambda1 <= 1.7e-23) {
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 <= (-6.6d-85)) then
tmp = t_0
else if (lambda1 <= 1.7d-23) 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 <= -6.6e-85) {
tmp = t_0;
} else if (lambda1 <= 1.7e-23) {
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 <= -6.6e-85: tmp = t_0 elif lambda1 <= 1.7e-23: 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 <= -6.6e-85) tmp = t_0; elseif (lambda1 <= 1.7e-23) tmp = atan(Float64(Float64(-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) * cos(phi2)), sin(phi2)); tmp = 0.0; if (lambda1 <= -6.6e-85) tmp = t_0; elseif (lambda1 <= 1.7e-23) 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, -6.6e-85], t$95$0, If[LessEqual[lambda1, 1.7e-23], 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 -6.6 \cdot 10^{-85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.7 \cdot 10^{-23}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(-\sin \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -6.59999999999999945e-85 or 1.7e-23 < lambda1 Initial program 64.8%
Taylor expanded in phi1 around 0
lift-sin.f6443.0
Applied rewrites43.0%
Taylor expanded in lambda1 around inf
Applied rewrites40.0%
if -6.59999999999999945e-85 < lambda1 < 1.7e-23Initial program 99.8%
Taylor expanded in phi1 around 0
lift-sin.f6457.9
Applied rewrites57.9%
Taylor expanded in lambda1 around 0
sin-negN/A
lower-neg.f64N/A
lift-sin.f6449.9
Applied rewrites49.9%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (* (sin lambda1) (cos phi2)) (sin phi2))))
(if (<= phi2 -175000.0)
t_0
(if (<= phi2 5.6e+92)
(atan2
(* (sin (- lambda1 lambda2)) (cos phi2))
(* phi2 (+ 1.0 (* -0.16666666666666666 (* phi2 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 (phi2 <= -175000.0) {
tmp = t_0;
} else if (phi2 <= 5.6e+92) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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 (phi2 <= (-175000.0d0)) then
tmp = t_0
else if (phi2 <= 5.6d+92) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (phi2 * (1.0d0 + ((-0.16666666666666666d0) * (phi2 * 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 (phi2 <= -175000.0) {
tmp = t_0;
} else if (phi2 <= 5.6e+92) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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 phi2 <= -175000.0: tmp = t_0 elif phi2 <= 5.6e+92: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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 (phi2 <= -175000.0) tmp = t_0; elseif (phi2 <= 5.6e+92) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(phi2 * Float64(1.0 + Float64(-0.16666666666666666 * Float64(phi2 * 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 (phi2 <= -175000.0) tmp = t_0; elseif (phi2 <= 5.6e+92) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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[phi2, -175000.0], t$95$0, If[LessEqual[phi2, 5.6e+92], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(phi2 * N[(1.0 + N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;\phi_2 \leq -175000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 5.6 \cdot 10^{+92}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\phi_2 \cdot \left(1 + -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if phi2 < -175000 or 5.60000000000000001e92 < phi2 Initial program 76.5%
Taylor expanded in phi1 around 0
lift-sin.f6448.2
Applied rewrites48.2%
Taylor expanded in lambda1 around inf
Applied rewrites30.0%
if -175000 < phi2 < 5.60000000000000001e92Initial program 80.9%
Taylor expanded in phi1 around 0
lift-sin.f6449.7
Applied rewrites49.7%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6446.4
Applied rewrites46.4%
(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.0%
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.4)
(atan2 t_0 phi2)
(atan2 t_0 (* phi2 (+ 1.0 (* -0.16666666666666666 (* phi2 phi2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = sin((lambda1 - lambda2)) * cos(phi2);
double tmp;
if (phi2 <= -2.4) {
tmp = atan2(t_0, phi2);
} else {
tmp = atan2(t_0, (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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) :: tmp
t_0 = sin((lambda1 - lambda2)) * cos(phi2)
if (phi2 <= (-2.4d0)) then
tmp = atan2(t_0, phi2)
else
tmp = atan2(t_0, (phi2 * (1.0d0 + ((-0.16666666666666666d0) * (phi2 * phi2)))))
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 tmp;
if (phi2 <= -2.4) {
tmp = Math.atan2(t_0, phi2);
} else {
tmp = Math.atan2(t_0, (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.sin((lambda1 - lambda2)) * math.cos(phi2) tmp = 0 if phi2 <= -2.4: tmp = math.atan2(t_0, phi2) else: tmp = math.atan2(t_0, (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)) tmp = 0.0 if (phi2 <= -2.4) tmp = atan(t_0, phi2); else tmp = atan(t_0, Float64(phi2 * Float64(1.0 + Float64(-0.16666666666666666 * Float64(phi2 * phi2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = sin((lambda1 - lambda2)) * cos(phi2); tmp = 0.0; if (phi2 <= -2.4) tmp = atan2(t_0, phi2); else tmp = atan2(t_0, (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))); 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]}, If[LessEqual[phi2, -2.4], N[ArcTan[t$95$0 / phi2], $MachinePrecision], N[ArcTan[t$95$0 / N[(phi2 * N[(1.0 + N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.4:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \left(1 + -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\end{array}
\end{array}
if phi2 < -2.39999999999999991Initial program 76.2%
Taylor expanded in phi1 around 0
lift-sin.f6448.5
Applied rewrites48.5%
Taylor expanded in phi2 around 0
Applied rewrites24.7%
if -2.39999999999999991 < phi2 Initial program 80.0%
Taylor expanded in phi1 around 0
lift-sin.f6449.3
Applied rewrites49.3%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6442.0
Applied rewrites42.0%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 1.85)
(atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) phi2)
(atan2
(* (+ lambda1 (* lambda2 (- (* 0.5 (* lambda1 lambda1)) 1.0))) (cos phi2))
(sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.85) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2);
} else {
tmp = atan2(((lambda1 + (lambda2 * ((0.5 * (lambda1 * lambda1)) - 1.0))) * 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.85d0) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2)
else
tmp = atan2(((lambda1 + (lambda2 * ((0.5d0 * (lambda1 * lambda1)) - 1.0d0))) * 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.85) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), phi2);
} else {
tmp = Math.atan2(((lambda1 + (lambda2 * ((0.5 * (lambda1 * lambda1)) - 1.0))) * Math.cos(phi2)), Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.85: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), phi2) else: tmp = math.atan2(((lambda1 + (lambda2 * ((0.5 * (lambda1 * lambda1)) - 1.0))) * math.cos(phi2)), math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.85) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan(Float64(Float64(lambda1 + Float64(lambda2 * Float64(Float64(0.5 * Float64(lambda1 * lambda1)) - 1.0))) * cos(phi2)), sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.85) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan2(((lambda1 + (lambda2 * ((0.5 * (lambda1 * lambda1)) - 1.0))) * cos(phi2)), sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.85], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(N[(lambda1 + N[(lambda2 * N[(N[(0.5 * N[(lambda1 * lambda1), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.85:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\left(\lambda_1 + \lambda_2 \cdot \left(0.5 \cdot \left(\lambda_1 \cdot \lambda_1\right) - 1\right)\right) \cdot \cos \phi_2}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.8500000000000001Initial program 79.8%
Taylor expanded in phi1 around 0
lift-sin.f6449.4
Applied rewrites49.4%
Taylor expanded in phi2 around 0
Applied rewrites41.1%
if 1.8500000000000001 < phi2 Initial program 76.8%
Taylor expanded in phi1 around 0
lift-sin.f6448.0
Applied rewrites48.0%
Taylor expanded in lambda1 around 0
lower-+.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
cos-neg-revN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-cos.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f6436.2
Applied rewrites36.2%
Taylor expanded in lambda2 around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6423.8
Applied rewrites23.8%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.2e+49) (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) phi2) (atan2 (* lambda1 (cos phi2)) (sin phi2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.2e+49) {
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2);
} else {
tmp = atan2((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.2d+49) then
tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2)
else
tmp = atan2((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.2e+49) {
tmp = Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), phi2);
} else {
tmp = Math.atan2((lambda1 * Math.cos(phi2)), Math.sin(phi2));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.2e+49: tmp = math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), phi2) else: tmp = math.atan2((lambda1 * math.cos(phi2)), math.sin(phi2)) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.2e+49) tmp = atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan(Float64(lambda1 * cos(phi2)), sin(phi2)); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.2e+49) tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), phi2); else tmp = atan2((lambda1 * cos(phi2)), sin(phi2)); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.2e+49], N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[(lambda1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.2 \cdot 10^{+49}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\lambda_1 \cdot \cos \phi_2}{\sin \phi_2}\\
\end{array}
\end{array}
if phi2 < 1.2e49Initial program 79.4%
Taylor expanded in phi1 around 0
lift-sin.f6449.3
Applied rewrites49.3%
Taylor expanded in phi2 around 0
Applied rewrites39.5%
if 1.2e49 < phi2 Initial program 77.6%
Taylor expanded in phi1 around 0
lift-sin.f6448.3
Applied rewrites48.3%
Taylor expanded in lambda1 around 0
lower-+.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
cos-neg-revN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-cos.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f6436.9
Applied rewrites36.9%
Taylor expanded in lambda2 around 0
Applied rewrites18.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 -175000.0)
(atan2 (* lambda1 (cos phi2)) (sin phi2))
(atan2
(sin (- lambda1 lambda2))
(* phi2 (+ 1.0 (* -0.16666666666666666 (* phi2 phi2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -175000.0) {
tmp = atan2((lambda1 * cos(phi2)), sin(phi2));
} else {
tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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 <= (-175000.0d0)) then
tmp = atan2((lambda1 * cos(phi2)), sin(phi2))
else
tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0d0 + ((-0.16666666666666666d0) * (phi2 * phi2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -175000.0) {
tmp = Math.atan2((lambda1 * Math.cos(phi2)), Math.sin(phi2));
} else {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= -175000.0: tmp = math.atan2((lambda1 * math.cos(phi2)), math.sin(phi2)) else: tmp = math.atan2(math.sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= -175000.0) tmp = atan(Float64(lambda1 * cos(phi2)), sin(phi2)); else tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(phi2 * Float64(1.0 + Float64(-0.16666666666666666 * Float64(phi2 * phi2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= -175000.0) tmp = atan2((lambda1 * cos(phi2)), sin(phi2)); else tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -175000.0], N[ArcTan[N[(lambda1 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(1.0 + N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq -175000:\\
\;\;\;\;\tan^{-1}_* \frac{\lambda_1 \cdot \cos \phi_2}{\sin \phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \left(1 + -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\end{array}
\end{array}
if phi2 < -175000Initial program 76.1%
Taylor expanded in phi1 around 0
lift-sin.f6448.3
Applied rewrites48.3%
Taylor expanded in lambda1 around 0
lower-+.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f64N/A
lower-*.f64N/A
cos-neg-revN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-cos.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
sin-negN/A
lower-neg.f64N/A
lift-sin.f6435.7
Applied rewrites35.7%
Taylor expanded in lambda2 around 0
Applied rewrites17.1%
if -175000 < phi2 Initial program 80.0%
Taylor expanded in phi1 around 0
lift-sin.f6449.3
Applied rewrites49.3%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6438.0
Applied rewrites38.0%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6437.8
Applied rewrites37.8%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= phi2 -1.02e-26)
(atan2 (- (sin lambda2)) phi2)
(atan2
(sin (- lambda1 lambda2))
(* phi2 (+ 1.0 (* -0.16666666666666666 (* phi2 phi2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -1.02e-26) {
tmp = atan2(-sin(lambda2), phi2);
} else {
tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * 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.02d-26)) then
tmp = atan2(-sin(lambda2), phi2)
else
tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0d0 + ((-0.16666666666666666d0) * (phi2 * phi2)))))
end if
code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= -1.02e-26) {
tmp = Math.atan2(-Math.sin(lambda2), phi2);
} else {
tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2)))));
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= -1.02e-26: tmp = math.atan2(-math.sin(lambda2), phi2) else: tmp = math.atan2(math.sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))) return tmp
function code(lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= -1.02e-26) tmp = atan(Float64(-sin(lambda2)), phi2); else tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(phi2 * Float64(1.0 + Float64(-0.16666666666666666 * Float64(phi2 * phi2))))); end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= -1.02e-26) tmp = atan2(-sin(lambda2), phi2); else tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + (-0.16666666666666666 * (phi2 * phi2))))); end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -1.02e-26], N[ArcTan[(-N[Sin[lambda2], $MachinePrecision]) / phi2], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(1.0 + N[(-0.16666666666666666 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq -1.02 \cdot 10^{-26}:\\
\;\;\;\;\tan^{-1}_* \frac{-\sin \lambda_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \left(1 + -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\
\end{array}
\end{array}
if phi2 < -1.02e-26Initial program 76.3%
Taylor expanded in phi1 around 0
lift-sin.f6449.2
Applied rewrites49.2%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6417.9
Applied rewrites17.9%
Taylor expanded in phi2 around 0
Applied rewrites17.9%
Taylor expanded in lambda1 around 0
sin-neg-revN/A
lift-sin.f64N/A
lift-neg.f6415.6
Applied rewrites15.6%
if -1.02e-26 < phi2 Initial program 80.1%
Taylor expanded in phi1 around 0
lift-sin.f6449.0
Applied rewrites49.0%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6437.6
Applied rewrites37.6%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6437.5
Applied rewrites37.5%
(FPCore (lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (atan2 (sin lambda1) phi2)))
(if (<= lambda1 -6.4e+147)
t_0
(if (<= lambda1 1.2e-20) (atan2 (- (sin lambda2)) phi2) t_0))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = atan2(sin(lambda1), phi2);
double tmp;
if (lambda1 <= -6.4e+147) {
tmp = t_0;
} else if (lambda1 <= 1.2e-20) {
tmp = atan2(-sin(lambda2), 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), phi2)
if (lambda1 <= (-6.4d+147)) then
tmp = t_0
else if (lambda1 <= 1.2d-20) then
tmp = atan2(-sin(lambda2), 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), phi2);
double tmp;
if (lambda1 <= -6.4e+147) {
tmp = t_0;
} else if (lambda1 <= 1.2e-20) {
tmp = Math.atan2(-Math.sin(lambda2), phi2);
} else {
tmp = t_0;
}
return tmp;
}
def code(lambda1, lambda2, phi1, phi2): t_0 = math.atan2(math.sin(lambda1), phi2) tmp = 0 if lambda1 <= -6.4e+147: tmp = t_0 elif lambda1 <= 1.2e-20: tmp = math.atan2(-math.sin(lambda2), phi2) else: tmp = t_0 return tmp
function code(lambda1, lambda2, phi1, phi2) t_0 = atan(sin(lambda1), phi2) tmp = 0.0 if (lambda1 <= -6.4e+147) tmp = t_0; elseif (lambda1 <= 1.2e-20) tmp = atan(Float64(-sin(lambda2)), phi2); else tmp = t_0; end return tmp end
function tmp_2 = code(lambda1, lambda2, phi1, phi2) t_0 = atan2(sin(lambda1), phi2); tmp = 0.0; if (lambda1 <= -6.4e+147) tmp = t_0; elseif (lambda1 <= 1.2e-20) tmp = atan2(-sin(lambda2), phi2); else tmp = t_0; end tmp_2 = tmp; end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[Sin[lambda1], $MachinePrecision] / phi2], $MachinePrecision]}, If[LessEqual[lambda1, -6.4e+147], t$95$0, If[LessEqual[lambda1, 1.2e-20], N[ArcTan[(-N[Sin[lambda2], $MachinePrecision]) / phi2], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}\\
\mathbf{if}\;\lambda_1 \leq -6.4 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.2 \cdot 10^{-20}:\\
\;\;\;\;\tan^{-1}_* \frac{-\sin \lambda_2}{\phi_2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if lambda1 < -6.39999999999999958e147 or 1.19999999999999996e-20 < lambda1 Initial program 61.3%
Taylor expanded in phi1 around 0
lift-sin.f6442.0
Applied rewrites42.0%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6429.3
Applied rewrites29.3%
Taylor expanded in phi2 around 0
Applied rewrites27.3%
Taylor expanded in lambda1 around inf
Applied rewrites27.1%
if -6.39999999999999958e147 < lambda1 < 1.19999999999999996e-20Initial program 91.0%
Taylor expanded in phi1 around 0
lift-sin.f6453.9
Applied rewrites53.9%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6433.9
Applied rewrites33.9%
Taylor expanded in phi2 around 0
Applied rewrites30.9%
Taylor expanded in lambda1 around 0
sin-neg-revN/A
lift-sin.f64N/A
lift-neg.f6425.7
Applied rewrites25.7%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin (- lambda1 lambda2)) phi2))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin((lambda1 - lambda2)), 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)), phi2)
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin((lambda1 - lambda2)), phi2);
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin((lambda1 - lambda2)), phi2)
function code(lambda1, lambda2, phi1, phi2) return atan(sin(Float64(lambda1 - lambda2)), phi2) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin((lambda1 - lambda2)), phi2); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / phi2], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2}
\end{array}
Initial program 79.0%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6432.1
Applied rewrites32.1%
Taylor expanded in phi2 around 0
Applied rewrites29.4%
(FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 (atan2 (sin lambda1) phi2))
double code(double lambda1, double lambda2, double phi1, double phi2) {
return atan2(sin(lambda1), 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), phi2)
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
return Math.atan2(Math.sin(lambda1), phi2);
}
def code(lambda1, lambda2, phi1, phi2): return math.atan2(math.sin(lambda1), phi2)
function code(lambda1, lambda2, phi1, phi2) return atan(sin(lambda1), phi2) end
function tmp = code(lambda1, lambda2, phi1, phi2) tmp = atan2(sin(lambda1), phi2); end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[lambda1], $MachinePrecision] / phi2], $MachinePrecision]
\begin{array}{l}
\\
\tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}
\end{array}
Initial program 79.0%
Taylor expanded in phi1 around 0
lift-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in phi2 around 0
sin-+PI/2-revN/A
sin-mult-revN/A
lift-sin.f64N/A
lift--.f6432.1
Applied rewrites32.1%
Taylor expanded in phi2 around 0
Applied rewrites29.4%
Taylor expanded in lambda1 around inf
Applied rewrites22.6%
herbie shell --seed 2025099
(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))))))