
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (let* ((t_0 (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2.0))))) (* R (sqrt (+ (* t_0 t_0) (* (- phi1 phi2) (- phi1 phi2)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0));
return R * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - 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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0d0))
code = r * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (lambda1 - lambda2) * Math.cos(((phi1 + phi2) / 2.0));
return R * Math.sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = (lambda1 - lambda2) * math.cos(((phi1 + phi2) / 2.0)) return R * math.sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(lambda1 - lambda2) * cos(Float64(Float64(phi1 + phi2) / 2.0))) return Float64(R * sqrt(Float64(Float64(t_0 * t_0) + Float64(Float64(phi1 - phi2) * Float64(phi1 - phi2))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0)); tmp = R * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(N[(phi1 + phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(R * N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[(phi1 - phi2), $MachinePrecision] * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\\
R \cdot \sqrt{t\_0 \cdot t\_0 + \left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}
\end{array}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (let* ((t_0 (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2.0))))) (* R (sqrt (+ (* t_0 t_0) (* (- phi1 phi2) (- phi1 phi2)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0));
return R * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - 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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: t_0
t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0d0))
code = r * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = (lambda1 - lambda2) * Math.cos(((phi1 + phi2) / 2.0));
return R * Math.sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))));
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = (lambda1 - lambda2) * math.cos(((phi1 + phi2) / 2.0)) return R * math.sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2))))
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(Float64(lambda1 - lambda2) * cos(Float64(Float64(phi1 + phi2) / 2.0))) return Float64(R * sqrt(Float64(Float64(t_0 * t_0) + Float64(Float64(phi1 - phi2) * Float64(phi1 - phi2))))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) t_0 = (lambda1 - lambda2) * cos(((phi1 + phi2) / 2.0)); tmp = R * sqrt(((t_0 * t_0) + ((phi1 - phi2) * (phi1 - phi2)))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(N[(phi1 + phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(R * N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[(phi1 - phi2), $MachinePrecision] * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\\
R \cdot \sqrt{t\_0 \cdot t\_0 + \left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}
\end{array}
\end{array}
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* (hypot (- phi1 phi2) (* (cos (/ (+ phi2 phi1) 2.0)) (- lambda1 lambda2))) R))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return hypot((phi1 - phi2), (cos(((phi2 + phi1) / 2.0)) * (lambda1 - lambda2))) * R;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return Math.hypot((phi1 - phi2), (Math.cos(((phi2 + phi1) / 2.0)) * (lambda1 - lambda2))) * R;
}
def code(R, lambda1, lambda2, phi1, phi2): return math.hypot((phi1 - phi2), (math.cos(((phi2 + phi1) / 2.0)) * (lambda1 - lambda2))) * R
function code(R, lambda1, lambda2, phi1, phi2) return Float64(hypot(Float64(phi1 - phi2), Float64(cos(Float64(Float64(phi2 + phi1) / 2.0)) * Float64(lambda1 - lambda2))) * R) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = hypot((phi1 - phi2), (cos(((phi2 + phi1) / 2.0)) * (lambda1 - lambda2))) * R; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(N[Cos[N[(N[(phi2 + phi1), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{hypot}\left(\phi_1 - \phi_2, \cos \left(\frac{\phi_2 + \phi_1}{2}\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R
\end{array}
Initial program 59.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.0%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 7e-68) (* (hypot (- phi1 phi2) (* (cos (* 0.5 phi1)) (- lambda1 lambda2))) R) (* (hypot (- phi1 phi2) (* (cos (* 0.5 phi2)) (- lambda1 lambda2))) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 7e-68) {
tmp = hypot((phi1 - phi2), (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = hypot((phi1 - phi2), (cos((0.5 * phi2)) * (lambda1 - lambda2))) * R;
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 7e-68) {
tmp = Math.hypot((phi1 - phi2), (Math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = Math.hypot((phi1 - phi2), (Math.cos((0.5 * phi2)) * (lambda1 - lambda2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 7e-68: tmp = math.hypot((phi1 - phi2), (math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R else: tmp = math.hypot((phi1 - phi2), (math.cos((0.5 * phi2)) * (lambda1 - lambda2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 7e-68) tmp = Float64(hypot(Float64(phi1 - phi2), Float64(cos(Float64(0.5 * phi1)) * Float64(lambda1 - lambda2))) * R); else tmp = Float64(hypot(Float64(phi1 - phi2), Float64(cos(Float64(0.5 * phi2)) * Float64(lambda1 - lambda2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 7e-68) tmp = hypot((phi1 - phi2), (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R; else tmp = hypot((phi1 - phi2), (cos((0.5 * phi2)) * (lambda1 - lambda2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 7e-68], N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision], N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 7 \cdot 10^{-68}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1 - \phi_2, \cos \left(0.5 \cdot \phi_1\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1 - \phi_2, \cos \left(0.5 \cdot \phi_2\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 7.00000000000000026e-68Initial program 60.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.1%
Taylor expanded in phi1 around inf
lower-*.f6493.0
Applied rewrites93.0%
if 7.00000000000000026e-68 < phi2 Initial program 56.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites93.5%
Taylor expanded in phi1 around 0
lower-*.f6491.9
Applied rewrites91.9%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* (hypot (- phi1 phi2) (* (cos (* 0.5 phi1)) (- lambda1 lambda2))) R))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return hypot((phi1 - phi2), (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return Math.hypot((phi1 - phi2), (Math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
}
def code(R, lambda1, lambda2, phi1, phi2): return math.hypot((phi1 - phi2), (math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R
function code(R, lambda1, lambda2, phi1, phi2) return Float64(hypot(Float64(phi1 - phi2), Float64(cos(Float64(0.5 * phi1)) * Float64(lambda1 - lambda2))) * R) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = hypot((phi1 - phi2), (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{hypot}\left(\phi_1 - \phi_2, \cos \left(0.5 \cdot \phi_1\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R
\end{array}
Initial program 59.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.0%
Taylor expanded in phi1 around inf
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 4.2e-11) (* (hypot phi1 (* (cos (* 0.5 phi1)) (- lambda1 lambda2))) R) (* (hypot (- phi1 phi2) (* (cos (* 0.5 phi2)) lambda1)) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.2e-11) {
tmp = hypot(phi1, (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = hypot((phi1 - phi2), (cos((0.5 * phi2)) * lambda1)) * R;
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.2e-11) {
tmp = Math.hypot(phi1, (Math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = Math.hypot((phi1 - phi2), (Math.cos((0.5 * phi2)) * lambda1)) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 4.2e-11: tmp = math.hypot(phi1, (math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R else: tmp = math.hypot((phi1 - phi2), (math.cos((0.5 * phi2)) * lambda1)) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 4.2e-11) tmp = Float64(hypot(phi1, Float64(cos(Float64(0.5 * phi1)) * Float64(lambda1 - lambda2))) * R); else tmp = Float64(hypot(Float64(phi1 - phi2), Float64(cos(Float64(0.5 * phi2)) * lambda1)) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 4.2e-11) tmp = hypot(phi1, (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R; else tmp = hypot((phi1 - phi2), (cos((0.5 * phi2)) * lambda1)) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 4.2e-11], N[(N[Sqrt[phi1 ^ 2 + N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision], N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision] * lambda1), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 4.2 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1, \cos \left(0.5 \cdot \phi_1\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1 - \phi_2, \cos \left(0.5 \cdot \phi_2\right) \cdot \lambda_1\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 4.1999999999999997e-11Initial program 60.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.3%
Taylor expanded in phi1 around inf
lower-*.f6493.4
Applied rewrites93.4%
Taylor expanded in phi1 around inf
Applied rewrites79.2%
if 4.1999999999999997e-11 < phi2 Initial program 54.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites92.4%
Taylor expanded in phi1 around 0
lower-*.f6492.2
Applied rewrites92.2%
Taylor expanded in lambda1 around inf
Applied rewrites83.1%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (cos (* 0.5 phi1))))
(if (<= phi2 4.2e-11)
(* (hypot phi1 (* t_0 (- lambda1 lambda2))) R)
(* (hypot (- phi1 phi2) (* t_0 lambda1)) R))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = cos((0.5 * phi1));
double tmp;
if (phi2 <= 4.2e-11) {
tmp = hypot(phi1, (t_0 * (lambda1 - lambda2))) * R;
} else {
tmp = hypot((phi1 - phi2), (t_0 * lambda1)) * R;
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = Math.cos((0.5 * phi1));
double tmp;
if (phi2 <= 4.2e-11) {
tmp = Math.hypot(phi1, (t_0 * (lambda1 - lambda2))) * R;
} else {
tmp = Math.hypot((phi1 - phi2), (t_0 * lambda1)) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = math.cos((0.5 * phi1)) tmp = 0 if phi2 <= 4.2e-11: tmp = math.hypot(phi1, (t_0 * (lambda1 - lambda2))) * R else: tmp = math.hypot((phi1 - phi2), (t_0 * lambda1)) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = cos(Float64(0.5 * phi1)) tmp = 0.0 if (phi2 <= 4.2e-11) tmp = Float64(hypot(phi1, Float64(t_0 * Float64(lambda1 - lambda2))) * R); else tmp = Float64(hypot(Float64(phi1 - phi2), Float64(t_0 * lambda1)) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = cos((0.5 * phi1)); tmp = 0.0; if (phi2 <= 4.2e-11) tmp = hypot(phi1, (t_0 * (lambda1 - lambda2))) * R; else tmp = hypot((phi1 - phi2), (t_0 * lambda1)) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 4.2e-11], N[(N[Sqrt[phi1 ^ 2 + N[(t$95$0 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision], N[(N[Sqrt[N[(phi1 - phi2), $MachinePrecision] ^ 2 + N[(t$95$0 * lambda1), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \phi_1\right)\\
\mathbf{if}\;\phi_2 \leq 4.2 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1, t\_0 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1 - \phi_2, t\_0 \cdot \lambda_1\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 4.1999999999999997e-11Initial program 60.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.3%
Taylor expanded in phi1 around inf
lower-*.f6493.4
Applied rewrites93.4%
Taylor expanded in phi1 around inf
Applied rewrites79.2%
if 4.1999999999999997e-11 < phi2 Initial program 54.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites92.4%
Taylor expanded in phi1 around inf
lower-*.f6482.4
Applied rewrites82.4%
Taylor expanded in lambda1 around inf
Applied rewrites78.3%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.2e-8) (* (hypot phi1 (* (cos (* 0.5 phi1)) (- lambda1 lambda2))) R) (* (* phi2 (- 1.0 (/ phi1 phi2))) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.2e-8) {
tmp = hypot(phi1, (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.2e-8) {
tmp = Math.hypot(phi1, (Math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.2e-8: tmp = math.hypot(phi1, (math.cos((0.5 * phi1)) * (lambda1 - lambda2))) * R else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.2e-8) tmp = Float64(hypot(phi1, Float64(cos(Float64(0.5 * phi1)) * Float64(lambda1 - lambda2))) * R); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.2e-8) tmp = hypot(phi1, (cos((0.5 * phi1)) * (lambda1 - lambda2))) * R; else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.2e-8], N[(N[Sqrt[phi1 ^ 2 + N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * R), $MachinePrecision], N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.2 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{hypot}\left(\phi_1, \cos \left(0.5 \cdot \phi_1\right) \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 1.19999999999999999e-8Initial program 60.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.3%
Taylor expanded in phi1 around inf
lower-*.f6493.4
Applied rewrites93.4%
Taylor expanded in phi1 around inf
Applied rewrites79.2%
if 1.19999999999999999e-8 < phi2 Initial program 54.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites92.3%
Taylor expanded in phi1 around 0
lower-*.f6492.2
Applied rewrites92.2%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6463.3
Applied rewrites63.3%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -9.4e+225)
(- (* R (* lambda1 (cos (* 0.5 phi2)))))
(if (<= lambda1 -8.5e+128)
(* (- phi1) (+ (- (/ (* phi2 R) phi1)) R))
(if (<= lambda1 -7.4e+96)
(* lambda1 (* R (- (cos (* 0.5 (+ phi1 phi2))))))
(* (* phi2 (- 1.0 (/ phi1 phi2))) R)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -7.4e+96) {
tmp = lambda1 * (R * -cos((0.5 * (phi1 + phi2))));
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (lambda1 <= (-9.4d+225)) then
tmp = -(r * (lambda1 * cos((0.5d0 * phi2))))
else if (lambda1 <= (-8.5d+128)) then
tmp = -phi1 * (-((phi2 * r) / phi1) + r)
else if (lambda1 <= (-7.4d+96)) then
tmp = lambda1 * (r * -cos((0.5d0 * (phi1 + phi2))))
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * Math.cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -7.4e+96) {
tmp = lambda1 * (R * -Math.cos((0.5 * (phi1 + phi2))));
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if lambda1 <= -9.4e+225: tmp = -(R * (lambda1 * math.cos((0.5 * phi2)))) elif lambda1 <= -8.5e+128: tmp = -phi1 * (-((phi2 * R) / phi1) + R) elif lambda1 <= -7.4e+96: tmp = lambda1 * (R * -math.cos((0.5 * (phi1 + phi2)))) else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -9.4e+225) tmp = Float64(-Float64(R * Float64(lambda1 * cos(Float64(0.5 * phi2))))); elseif (lambda1 <= -8.5e+128) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(Float64(phi2 * R) / phi1)) + R)); elseif (lambda1 <= -7.4e+96) tmp = Float64(lambda1 * Float64(R * Float64(-cos(Float64(0.5 * Float64(phi1 + phi2)))))); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (lambda1 <= -9.4e+225) tmp = -(R * (lambda1 * cos((0.5 * phi2)))); elseif (lambda1 <= -8.5e+128) tmp = -phi1 * (-((phi2 * R) / phi1) + R); elseif (lambda1 <= -7.4e+96) tmp = lambda1 * (R * -cos((0.5 * (phi1 + phi2)))); else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -9.4e+225], (-N[(R * N[(lambda1 * N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[lambda1, -8.5e+128], N[((-phi1) * N[((-N[(N[(phi2 * R), $MachinePrecision] / phi1), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, -7.4e+96], N[(lambda1 * N[(R * (-N[Cos[N[(0.5 * N[(phi1 + phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -9.4 \cdot 10^{+225}:\\
\;\;\;\;-R \cdot \left(\lambda_1 \cdot \cos \left(0.5 \cdot \phi_2\right)\right)\\
\mathbf{elif}\;\lambda_1 \leq -8.5 \cdot 10^{+128}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-\frac{\phi_2 \cdot R}{\phi_1}\right) + R\right)\\
\mathbf{elif}\;\lambda_1 \leq -7.4 \cdot 10^{+96}:\\
\;\;\;\;\lambda_1 \cdot \left(R \cdot \left(-\cos \left(0.5 \cdot \left(\phi_1 + \phi_2\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if lambda1 < -9.40000000000000008e225Initial program 46.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites89.3%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-cos.f64N/A
lift-+.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
Taylor expanded in phi1 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-*.f6451.7
Applied rewrites51.7%
if -9.40000000000000008e225 < lambda1 < -8.50000000000000045e128Initial program 47.3%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.4
Applied rewrites23.4%
if -8.50000000000000045e128 < lambda1 < -7.39999999999999982e96Initial program 63.0%
Taylor expanded in lambda2 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.9%
Taylor expanded in lambda1 around inf
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites38.0%
Taylor expanded in R around 0
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-+.f6438.0
Applied rewrites38.0%
Taylor expanded in lambda1 around inf
mul-1-negN/A
lower-neg.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f6429.0
Applied rewrites29.0%
if -7.39999999999999982e96 < lambda1 Initial program 61.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.6%
Taylor expanded in phi1 around 0
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6429.0
Applied rewrites29.0%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -9.4e+225)
(- (* R (* lambda1 (cos (* 0.5 phi2)))))
(if (<= lambda1 -8.5e+128)
(* (- phi1) (+ (- (/ (* phi2 R) phi1)) R))
(if (<= lambda1 -7.4e+96)
(- (* (* (cos (* 0.5 (+ phi2 phi1))) lambda1) R))
(* (* phi2 (- 1.0 (/ phi1 phi2))) R)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -7.4e+96) {
tmp = -((cos((0.5 * (phi2 + phi1))) * lambda1) * R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (lambda1 <= (-9.4d+225)) then
tmp = -(r * (lambda1 * cos((0.5d0 * phi2))))
else if (lambda1 <= (-8.5d+128)) then
tmp = -phi1 * (-((phi2 * r) / phi1) + r)
else if (lambda1 <= (-7.4d+96)) then
tmp = -((cos((0.5d0 * (phi2 + phi1))) * lambda1) * r)
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * Math.cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -7.4e+96) {
tmp = -((Math.cos((0.5 * (phi2 + phi1))) * lambda1) * R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if lambda1 <= -9.4e+225: tmp = -(R * (lambda1 * math.cos((0.5 * phi2)))) elif lambda1 <= -8.5e+128: tmp = -phi1 * (-((phi2 * R) / phi1) + R) elif lambda1 <= -7.4e+96: tmp = -((math.cos((0.5 * (phi2 + phi1))) * lambda1) * R) else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -9.4e+225) tmp = Float64(-Float64(R * Float64(lambda1 * cos(Float64(0.5 * phi2))))); elseif (lambda1 <= -8.5e+128) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(Float64(phi2 * R) / phi1)) + R)); elseif (lambda1 <= -7.4e+96) tmp = Float64(-Float64(Float64(cos(Float64(0.5 * Float64(phi2 + phi1))) * lambda1) * R)); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (lambda1 <= -9.4e+225) tmp = -(R * (lambda1 * cos((0.5 * phi2)))); elseif (lambda1 <= -8.5e+128) tmp = -phi1 * (-((phi2 * R) / phi1) + R); elseif (lambda1 <= -7.4e+96) tmp = -((cos((0.5 * (phi2 + phi1))) * lambda1) * R); else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -9.4e+225], (-N[(R * N[(lambda1 * N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[lambda1, -8.5e+128], N[((-phi1) * N[((-N[(N[(phi2 * R), $MachinePrecision] / phi1), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, -7.4e+96], (-N[(N[(N[Cos[N[(0.5 * N[(phi2 + phi1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * lambda1), $MachinePrecision] * R), $MachinePrecision]), N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -9.4 \cdot 10^{+225}:\\
\;\;\;\;-R \cdot \left(\lambda_1 \cdot \cos \left(0.5 \cdot \phi_2\right)\right)\\
\mathbf{elif}\;\lambda_1 \leq -8.5 \cdot 10^{+128}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-\frac{\phi_2 \cdot R}{\phi_1}\right) + R\right)\\
\mathbf{elif}\;\lambda_1 \leq -7.4 \cdot 10^{+96}:\\
\;\;\;\;-\left(\cos \left(0.5 \cdot \left(\phi_2 + \phi_1\right)\right) \cdot \lambda_1\right) \cdot R\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if lambda1 < -9.40000000000000008e225Initial program 46.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites89.3%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-cos.f64N/A
lift-+.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
Taylor expanded in phi1 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-*.f6451.7
Applied rewrites51.7%
if -9.40000000000000008e225 < lambda1 < -8.50000000000000045e128Initial program 47.3%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.4
Applied rewrites23.4%
if -8.50000000000000045e128 < lambda1 < -7.39999999999999982e96Initial program 63.0%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6429.1
Applied rewrites29.1%
if -7.39999999999999982e96 < lambda1 Initial program 61.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.6%
Taylor expanded in phi1 around 0
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6429.0
Applied rewrites29.0%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -9.4e+225)
(- (* R (* lambda1 (cos (* 0.5 phi2)))))
(if (<= lambda1 -8.5e+128)
(* (- phi1) (+ (- (/ (* phi2 R) phi1)) R))
(if (<= lambda1 -5.6e+97)
(- (* R (* lambda1 (cos (* 0.5 phi1)))))
(* (* phi2 (- 1.0 (/ phi1 phi2))) R)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -5.6e+97) {
tmp = -(R * (lambda1 * cos((0.5 * phi1))));
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (lambda1 <= (-9.4d+225)) then
tmp = -(r * (lambda1 * cos((0.5d0 * phi2))))
else if (lambda1 <= (-8.5d+128)) then
tmp = -phi1 * (-((phi2 * r) / phi1) + r)
else if (lambda1 <= (-5.6d+97)) then
tmp = -(r * (lambda1 * cos((0.5d0 * phi1))))
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -9.4e+225) {
tmp = -(R * (lambda1 * Math.cos((0.5 * phi2))));
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -5.6e+97) {
tmp = -(R * (lambda1 * Math.cos((0.5 * phi1))));
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if lambda1 <= -9.4e+225: tmp = -(R * (lambda1 * math.cos((0.5 * phi2)))) elif lambda1 <= -8.5e+128: tmp = -phi1 * (-((phi2 * R) / phi1) + R) elif lambda1 <= -5.6e+97: tmp = -(R * (lambda1 * math.cos((0.5 * phi1)))) else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -9.4e+225) tmp = Float64(-Float64(R * Float64(lambda1 * cos(Float64(0.5 * phi2))))); elseif (lambda1 <= -8.5e+128) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(Float64(phi2 * R) / phi1)) + R)); elseif (lambda1 <= -5.6e+97) tmp = Float64(-Float64(R * Float64(lambda1 * cos(Float64(0.5 * phi1))))); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (lambda1 <= -9.4e+225) tmp = -(R * (lambda1 * cos((0.5 * phi2)))); elseif (lambda1 <= -8.5e+128) tmp = -phi1 * (-((phi2 * R) / phi1) + R); elseif (lambda1 <= -5.6e+97) tmp = -(R * (lambda1 * cos((0.5 * phi1)))); else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -9.4e+225], (-N[(R * N[(lambda1 * N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[lambda1, -8.5e+128], N[((-phi1) * N[((-N[(N[(phi2 * R), $MachinePrecision] / phi1), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, -5.6e+97], (-N[(R * N[(lambda1 * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -9.4 \cdot 10^{+225}:\\
\;\;\;\;-R \cdot \left(\lambda_1 \cdot \cos \left(0.5 \cdot \phi_2\right)\right)\\
\mathbf{elif}\;\lambda_1 \leq -8.5 \cdot 10^{+128}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-\frac{\phi_2 \cdot R}{\phi_1}\right) + R\right)\\
\mathbf{elif}\;\lambda_1 \leq -5.6 \cdot 10^{+97}:\\
\;\;\;\;-R \cdot \left(\lambda_1 \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if lambda1 < -9.40000000000000008e225Initial program 46.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites89.3%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-cos.f64N/A
lift-+.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
Taylor expanded in phi1 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-*.f6451.7
Applied rewrites51.7%
if -9.40000000000000008e225 < lambda1 < -8.50000000000000045e128Initial program 47.3%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.4
Applied rewrites23.4%
if -8.50000000000000045e128 < lambda1 < -5.5999999999999998e97Initial program 63.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.9%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-cos.f64N/A
lift-+.f64N/A
lift-*.f6429.6
Applied rewrites29.6%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6431.6
Applied rewrites31.6%
if -5.5999999999999998e97 < lambda1 Initial program 61.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.6%
Taylor expanded in phi1 around 0
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6429.0
Applied rewrites29.0%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (- (* R (* lambda1 (cos (* 0.5 phi1)))))))
(if (<= lambda1 -9e+225)
t_0
(if (<= lambda1 -8.5e+128)
(* (- phi1) (+ (- (/ (* phi2 R) phi1)) R))
(if (<= lambda1 -5.6e+97) t_0 (* (* phi2 (- 1.0 (/ phi1 phi2))) R))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -(R * (lambda1 * cos((0.5 * phi1))));
double tmp;
if (lambda1 <= -9e+225) {
tmp = t_0;
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -5.6e+97) {
tmp = t_0;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
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 = -(r * (lambda1 * cos((0.5d0 * phi1))))
if (lambda1 <= (-9d+225)) then
tmp = t_0
else if (lambda1 <= (-8.5d+128)) then
tmp = -phi1 * (-((phi2 * r) / phi1) + r)
else if (lambda1 <= (-5.6d+97)) then
tmp = t_0
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = -(R * (lambda1 * Math.cos((0.5 * phi1))));
double tmp;
if (lambda1 <= -9e+225) {
tmp = t_0;
} else if (lambda1 <= -8.5e+128) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else if (lambda1 <= -5.6e+97) {
tmp = t_0;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = -(R * (lambda1 * math.cos((0.5 * phi1)))) tmp = 0 if lambda1 <= -9e+225: tmp = t_0 elif lambda1 <= -8.5e+128: tmp = -phi1 * (-((phi2 * R) / phi1) + R) elif lambda1 <= -5.6e+97: tmp = t_0 else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(-Float64(R * Float64(lambda1 * cos(Float64(0.5 * phi1))))) tmp = 0.0 if (lambda1 <= -9e+225) tmp = t_0; elseif (lambda1 <= -8.5e+128) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(Float64(phi2 * R) / phi1)) + R)); elseif (lambda1 <= -5.6e+97) tmp = t_0; else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = -(R * (lambda1 * cos((0.5 * phi1)))); tmp = 0.0; if (lambda1 <= -9e+225) tmp = t_0; elseif (lambda1 <= -8.5e+128) tmp = -phi1 * (-((phi2 * R) / phi1) + R); elseif (lambda1 <= -5.6e+97) tmp = t_0; else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = (-N[(R * N[(lambda1 * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[lambda1, -9e+225], t$95$0, If[LessEqual[lambda1, -8.5e+128], N[((-phi1) * N[((-N[(N[(phi2 * R), $MachinePrecision] / phi1), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, -5.6e+97], t$95$0, N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -R \cdot \left(\lambda_1 \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\\
\mathbf{if}\;\lambda_1 \leq -9 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq -8.5 \cdot 10^{+128}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-\frac{\phi_2 \cdot R}{\phi_1}\right) + R\right)\\
\mathbf{elif}\;\lambda_1 \leq -5.6 \cdot 10^{+97}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if lambda1 < -8.99999999999999952e225 or -8.50000000000000045e128 < lambda1 < -5.5999999999999998e97Initial program 51.7%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites91.6%
Taylor expanded in lambda1 around -inf
mul-1-negN/A
lower-neg.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-cos.f64N/A
lift-+.f64N/A
lift-*.f6442.0
Applied rewrites42.0%
Taylor expanded in phi2 around 0
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6445.8
Applied rewrites45.8%
if -8.99999999999999952e225 < lambda1 < -8.50000000000000045e128Initial program 47.3%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6423.4
Applied rewrites23.4%
if -5.5999999999999998e97 < lambda1 Initial program 61.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites96.6%
Taylor expanded in phi1 around 0
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6429.0
Applied rewrites29.0%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 4.5e+23) (* (- phi1) (+ (- (* R (/ phi2 phi1))) R)) (* (* phi2 (- 1.0 (/ phi1 phi2))) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.5e+23) {
tmp = -phi1 * (-(R * (phi2 / phi1)) + R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
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 <= 4.5d+23) then
tmp = -phi1 * (-(r * (phi2 / phi1)) + r)
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.5e+23) {
tmp = -phi1 * (-(R * (phi2 / phi1)) + R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 4.5e+23: tmp = -phi1 * (-(R * (phi2 / phi1)) + R) else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 4.5e+23) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(R * Float64(phi2 / phi1))) + R)); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 4.5e+23) tmp = -phi1 * (-(R * (phi2 / phi1)) + R); else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 4.5e+23], N[((-phi1) * N[((-N[(R * N[(phi2 / phi1), $MachinePrecision]), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 4.5 \cdot 10^{+23}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-R \cdot \frac{\phi_2}{\phi_1}\right) + R\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 4.49999999999999979e23Initial program 61.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.1%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6419.3
Applied rewrites19.3%
if 4.49999999999999979e23 < phi2 Initial program 52.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites92.4%
Taylor expanded in phi1 around 0
lower-*.f6492.3
Applied rewrites92.3%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6466.3
Applied rewrites66.3%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= (- lambda1 lambda2) -6e+92) (* (- phi1) (+ (- (/ (* phi2 R) phi1)) R)) (* (* phi2 (- 1.0 (/ phi1 phi2))) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda1 - lambda2) <= -6e+92) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if ((lambda1 - lambda2) <= (-6d+92)) then
tmp = -phi1 * (-((phi2 * r) / phi1) + r)
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if ((lambda1 - lambda2) <= -6e+92) {
tmp = -phi1 * (-((phi2 * R) / phi1) + R);
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if (lambda1 - lambda2) <= -6e+92: tmp = -phi1 * (-((phi2 * R) / phi1) + R) else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (Float64(lambda1 - lambda2) <= -6e+92) tmp = Float64(Float64(-phi1) * Float64(Float64(-Float64(Float64(phi2 * R) / phi1)) + R)); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if ((lambda1 - lambda2) <= -6e+92) tmp = -phi1 * (-((phi2 * R) / phi1) + R); else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[N[(lambda1 - lambda2), $MachinePrecision], -6e+92], N[((-phi1) * N[((-N[(N[(phi2 * R), $MachinePrecision] / phi1), $MachinePrecision]) + R), $MachinePrecision]), $MachinePrecision], N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 - \lambda_2 \leq -6 \cdot 10^{+92}:\\
\;\;\;\;\left(-\phi_1\right) \cdot \left(\left(-\frac{\phi_2 \cdot R}{\phi_1}\right) + R\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if (-.f64 lambda1 lambda2) < -6.00000000000000026e92Initial program 49.9%
Taylor expanded in phi1 around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.2
Applied rewrites21.2%
if -6.00000000000000026e92 < (-.f64 lambda1 lambda2) Initial program 62.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites97.0%
Taylor expanded in phi1 around 0
lower-*.f6493.0
Applied rewrites93.0%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6430.7
Applied rewrites30.7%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 7.2e-195) (* R (- phi1)) (* (* phi2 (- 1.0 (/ phi1 phi2))) R)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 7.2e-195) {
tmp = R * -phi1;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
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 <= 7.2d-195) then
tmp = r * -phi1
else
tmp = (phi2 * (1.0d0 - (phi1 / phi2))) * r
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 7.2e-195) {
tmp = R * -phi1;
} else {
tmp = (phi2 * (1.0 - (phi1 / phi2))) * R;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 7.2e-195: tmp = R * -phi1 else: tmp = (phi2 * (1.0 - (phi1 / phi2))) * R return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 7.2e-195) tmp = Float64(R * Float64(-phi1)); else tmp = Float64(Float64(phi2 * Float64(1.0 - Float64(phi1 / phi2))) * R); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 7.2e-195) tmp = R * -phi1; else tmp = (phi2 * (1.0 - (phi1 / phi2))) * R; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 7.2e-195], N[(R * (-phi1)), $MachinePrecision], N[(N[(phi2 * N[(1.0 - N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * R), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 7.2 \cdot 10^{-195}:\\
\;\;\;\;R \cdot \left(-\phi_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\phi_2 \cdot \left(1 - \frac{\phi_1}{\phi_2}\right)\right) \cdot R\\
\end{array}
\end{array}
if phi2 < 7.2e-195Initial program 59.3%
Taylor expanded in phi1 around -inf
mul-1-negN/A
lower-neg.f6417.6
Applied rewrites17.6%
if 7.2e-195 < phi2 Initial program 58.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
Applied rewrites95.1%
Taylor expanded in phi1 around 0
lower-*.f6491.4
Applied rewrites91.4%
Taylor expanded in phi2 around inf
metadata-evalN/A
fp-cancel-sub-sign-invN/A
lower-*.f64N/A
*-lft-identityN/A
lower--.f64N/A
lift-/.f6449.0
Applied rewrites49.0%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi1 -2.3e+55) (* R (- phi1)) (* R phi2)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi1 <= -2.3e+55) {
tmp = R * -phi1;
} else {
tmp = R * 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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
real(8) :: tmp
if (phi1 <= (-2.3d+55)) then
tmp = r * -phi1
else
tmp = r * phi2
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi1 <= -2.3e+55) {
tmp = R * -phi1;
} else {
tmp = R * phi2;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi1 <= -2.3e+55: tmp = R * -phi1 else: tmp = R * phi2 return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi1 <= -2.3e+55) tmp = Float64(R * Float64(-phi1)); else tmp = Float64(R * phi2); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi1 <= -2.3e+55) tmp = R * -phi1; else tmp = R * phi2; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi1, -2.3e+55], N[(R * (-phi1)), $MachinePrecision], N[(R * phi2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_1 \leq -2.3 \cdot 10^{+55}:\\
\;\;\;\;R \cdot \left(-\phi_1\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \phi_2\\
\end{array}
\end{array}
if phi1 < -2.29999999999999987e55Initial program 50.5%
Taylor expanded in phi1 around -inf
mul-1-negN/A
lower-neg.f6464.9
Applied rewrites64.9%
if -2.29999999999999987e55 < phi1 Initial program 61.4%
Taylor expanded in phi2 around inf
Applied rewrites18.8%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* R phi2))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * 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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = r * phi2
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * phi2;
}
def code(R, lambda1, lambda2, phi1, phi2): return R * phi2
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * phi2) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * phi2; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * phi2), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \phi_2
\end{array}
Initial program 59.1%
Taylor expanded in phi2 around inf
Applied rewrites17.5%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* R phi1))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * phi1;
}
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(r, lambda1, lambda2, phi1, phi2)
use fmin_fmax_functions
real(8), intent (in) :: r
real(8), intent (in) :: lambda1
real(8), intent (in) :: lambda2
real(8), intent (in) :: phi1
real(8), intent (in) :: phi2
code = r * phi1
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * phi1;
}
def code(R, lambda1, lambda2, phi1, phi2): return R * phi1
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * phi1) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * phi1; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * phi1), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \phi_1
\end{array}
Initial program 59.1%
Taylor expanded in phi1 around inf
Applied rewrites17.7%
herbie shell --seed 2025112
(FPCore (R lambda1 lambda2 phi1 phi2)
:name "Equirectangular approximation to distance on a great circle"
:precision binary64
(* R (sqrt (+ (* (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2.0))) (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2.0)))) (* (- phi1 phi2) (- phi1 phi2))))))