
(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))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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}
Sampling outcomes in binary64 precision:
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))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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
(*
R
(hypot
(*
(- lambda1 lambda2)
(fma
(cos (* phi2 0.5))
(cos (* 0.5 phi1))
(* (sin (* 0.5 phi1)) (- (sin (* phi2 0.5))))))
(- phi1 phi2))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * hypot(((lambda1 - lambda2) * fma(cos((phi2 * 0.5)), cos((0.5 * phi1)), (sin((0.5 * phi1)) * -sin((phi2 * 0.5))))), (phi1 - phi2));
}
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * hypot(Float64(Float64(lambda1 - lambda2) * fma(cos(Float64(phi2 * 0.5)), cos(Float64(0.5 * phi1)), Float64(sin(Float64(0.5 * phi1)) * Float64(-sin(Float64(phi2 * 0.5)))))), Float64(phi1 - phi2))) end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[Sqrt[N[(N[(lambda1 - lambda2), $MachinePrecision] * N[(N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + N[(phi1 - phi2), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \mathsf{hypot}\left(\left(\lambda_1 - \lambda_2\right) \cdot \mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \cos \left(0.5 \cdot \phi_1\right), \sin \left(0.5 \cdot \phi_1\right) \cdot \left(-\sin \left(\phi_2 \cdot 0.5\right)\right)\right), \phi_1 - \phi_2\right)
\end{array}
Initial program 62.1%
hypot-define96.3%
Simplified96.3%
log1p-expm1-u96.3%
div-inv96.3%
metadata-eval96.3%
Applied egg-rr96.3%
*-commutative96.3%
+-commutative96.3%
distribute-rgt-in96.3%
*-commutative96.3%
cos-sum99.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
log1p-expm1-u99.9%
fma-neg99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -2.1e+236)
(*
R
(hypot
(*
lambda1
(-
(* (cos (* 0.5 phi1)) (cos (* phi2 0.5)))
(* (sin (* 0.5 phi1)) (sin (* phi2 0.5)))))
(- phi1 phi2)))
(*
R
(hypot
(* (- lambda1 lambda2) (log1p (expm1 (cos (* 0.5 (+ phi2 phi1))))))
(- phi1 phi2)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -2.1e+236) {
tmp = R * hypot((lambda1 * ((cos((0.5 * phi1)) * cos((phi2 * 0.5))) - (sin((0.5 * phi1)) * sin((phi2 * 0.5))))), (phi1 - phi2));
} else {
tmp = R * hypot(((lambda1 - lambda2) * log1p(expm1(cos((0.5 * (phi2 + phi1)))))), (phi1 - phi2));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -2.1e+236) {
tmp = R * Math.hypot((lambda1 * ((Math.cos((0.5 * phi1)) * Math.cos((phi2 * 0.5))) - (Math.sin((0.5 * phi1)) * Math.sin((phi2 * 0.5))))), (phi1 - phi2));
} else {
tmp = R * Math.hypot(((lambda1 - lambda2) * Math.log1p(Math.expm1(Math.cos((0.5 * (phi2 + phi1)))))), (phi1 - phi2));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if lambda1 <= -2.1e+236: tmp = R * math.hypot((lambda1 * ((math.cos((0.5 * phi1)) * math.cos((phi2 * 0.5))) - (math.sin((0.5 * phi1)) * math.sin((phi2 * 0.5))))), (phi1 - phi2)) else: tmp = R * math.hypot(((lambda1 - lambda2) * math.log1p(math.expm1(math.cos((0.5 * (phi2 + phi1)))))), (phi1 - phi2)) return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -2.1e+236) tmp = Float64(R * hypot(Float64(lambda1 * Float64(Float64(cos(Float64(0.5 * phi1)) * cos(Float64(phi2 * 0.5))) - Float64(sin(Float64(0.5 * phi1)) * sin(Float64(phi2 * 0.5))))), Float64(phi1 - phi2))); else tmp = Float64(R * hypot(Float64(Float64(lambda1 - lambda2) * log1p(expm1(cos(Float64(0.5 * Float64(phi2 + phi1)))))), Float64(phi1 - phi2))); end return tmp end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -2.1e+236], N[(R * N[Sqrt[N[(lambda1 * N[(N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + N[(phi1 - phi2), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(R * N[Sqrt[N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Log[1 + N[(Exp[N[Cos[N[(0.5 * N[(phi2 + phi1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(phi1 - phi2), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -2.1 \cdot 10^{+236}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\lambda_1 \cdot \left(\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right), \phi_1 - \phi_2\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\left(\lambda_1 - \lambda_2\right) \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(0.5 \cdot \left(\phi_2 + \phi_1\right)\right)\right)\right), \phi_1 - \phi_2\right)\\
\end{array}
\end{array}
if lambda1 < -2.10000000000000006e236Initial program 49.1%
hypot-define87.8%
Simplified87.8%
log1p-expm1-u87.7%
div-inv87.7%
metadata-eval87.7%
Applied egg-rr87.7%
*-commutative87.7%
+-commutative87.7%
distribute-rgt-in87.7%
*-commutative87.7%
cos-sum99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in lambda1 around inf 99.9%
*-commutative99.9%
Simplified99.9%
if -2.10000000000000006e236 < lambda1 Initial program 63.5%
hypot-define97.2%
Simplified97.2%
log1p-expm1-u97.2%
div-inv97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Final simplification97.5%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 1.4e-11) (* R (hypot phi1 (* (- lambda1 lambda2) (cos (* 0.5 phi1))))) (* R (hypot phi2 (* (- lambda1 lambda2) (cos (* phi2 0.5)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.4e-11) {
tmp = R * hypot(phi1, ((lambda1 - lambda2) * cos((0.5 * phi1))));
} else {
tmp = R * hypot(phi2, ((lambda1 - lambda2) * cos((phi2 * 0.5))));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 1.4e-11) {
tmp = R * Math.hypot(phi1, ((lambda1 - lambda2) * Math.cos((0.5 * phi1))));
} else {
tmp = R * Math.hypot(phi2, ((lambda1 - lambda2) * Math.cos((phi2 * 0.5))));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 1.4e-11: tmp = R * math.hypot(phi1, ((lambda1 - lambda2) * math.cos((0.5 * phi1)))) else: tmp = R * math.hypot(phi2, ((lambda1 - lambda2) * math.cos((phi2 * 0.5)))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 1.4e-11) tmp = Float64(R * hypot(phi1, Float64(Float64(lambda1 - lambda2) * cos(Float64(0.5 * phi1))))); else tmp = Float64(R * hypot(phi2, Float64(Float64(lambda1 - lambda2) * cos(Float64(phi2 * 0.5))))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 1.4e-11) tmp = R * hypot(phi1, ((lambda1 - lambda2) * cos((0.5 * phi1)))); else tmp = R * hypot(phi2, ((lambda1 - lambda2) * cos((phi2 * 0.5)))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 1.4e-11], N[(R * N[Sqrt[phi1 ^ 2 + N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(R * N[Sqrt[phi2 ^ 2 + N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 1.4 \cdot 10^{-11}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\phi_1, \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\phi_2, \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\phi_2 \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if phi2 < 1.4e-11Initial program 62.4%
hypot-define96.6%
Simplified96.6%
Taylor expanded in phi2 around 0 54.9%
+-commutative54.9%
unpow254.9%
unpow254.9%
unpow254.9%
unswap-sqr54.9%
hypot-define83.4%
Simplified83.4%
if 1.4e-11 < phi2 Initial program 60.8%
hypot-define95.2%
Simplified95.2%
Taylor expanded in phi1 around 0 53.1%
+-commutative53.1%
unpow253.1%
unpow253.1%
unpow253.1%
unswap-sqr53.1%
hypot-define80.3%
Simplified80.3%
Final simplification82.8%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 4.9e-11) (* R (hypot phi1 (* (- lambda1 lambda2) (cos (* 0.5 phi1))))) (* phi2 (- R (* phi1 (/ R phi2))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.9e-11) {
tmp = R * hypot(phi1, ((lambda1 - lambda2) * cos((0.5 * phi1))));
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.9e-11) {
tmp = R * Math.hypot(phi1, ((lambda1 - lambda2) * Math.cos((0.5 * phi1))));
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 4.9e-11: tmp = R * math.hypot(phi1, ((lambda1 - lambda2) * math.cos((0.5 * phi1)))) else: tmp = phi2 * (R - (phi1 * (R / phi2))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 4.9e-11) tmp = Float64(R * hypot(phi1, Float64(Float64(lambda1 - lambda2) * cos(Float64(0.5 * phi1))))); else tmp = Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 4.9e-11) tmp = R * hypot(phi1, ((lambda1 - lambda2) * cos((0.5 * phi1)))); else tmp = phi2 * (R - (phi1 * (R / phi2))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 4.9e-11], N[(R * N[Sqrt[phi1 ^ 2 + N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 4.9 \cdot 10^{-11}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\phi_1, \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)\\
\end{array}
\end{array}
if phi2 < 4.8999999999999999e-11Initial program 62.4%
hypot-define96.6%
Simplified96.6%
Taylor expanded in phi2 around 0 54.9%
+-commutative54.9%
unpow254.9%
unpow254.9%
unpow254.9%
unswap-sqr54.9%
hypot-define83.4%
Simplified83.4%
if 4.8999999999999999e-11 < phi2 Initial program 60.8%
hypot-define95.2%
Simplified95.2%
Taylor expanded in phi2 around inf 64.6%
mul-1-neg64.6%
unsub-neg64.6%
*-commutative64.6%
associate-/l*66.5%
Simplified66.5%
Final simplification80.0%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* R (hypot (* (- lambda1 lambda2) (cos (/ (+ phi2 phi1) 2.0))) (- phi1 phi2))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * hypot(((lambda1 - lambda2) * cos(((phi2 + phi1) / 2.0))), (phi1 - phi2));
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * Math.hypot(((lambda1 - lambda2) * Math.cos(((phi2 + phi1) / 2.0))), (phi1 - phi2));
}
def code(R, lambda1, lambda2, phi1, phi2): return R * math.hypot(((lambda1 - lambda2) * math.cos(((phi2 + phi1) / 2.0))), (phi1 - phi2))
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * hypot(Float64(Float64(lambda1 - lambda2) * cos(Float64(Float64(phi2 + phi1) / 2.0))), Float64(phi1 - phi2))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * hypot(((lambda1 - lambda2) * cos(((phi2 + phi1) / 2.0))), (phi1 - phi2)); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[Sqrt[N[(N[(lambda1 - lambda2), $MachinePrecision] * N[Cos[N[(N[(phi2 + phi1), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(phi1 - phi2), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \mathsf{hypot}\left(\left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_2 + \phi_1}{2}\right), \phi_1 - \phi_2\right)
\end{array}
Initial program 62.1%
hypot-define96.3%
Simplified96.3%
Final simplification96.3%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* R (hypot lambda1 phi1))))
(if (<= phi2 7.5e-94)
t_0
(if (<= phi2 1.02e-65)
(* R (hypot phi1 (- lambda2)))
(if (<= phi2 1.3e-16) t_0 (* phi2 (- R (* phi1 (/ R phi2)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * hypot(lambda1, phi1);
double tmp;
if (phi2 <= 7.5e-94) {
tmp = t_0;
} else if (phi2 <= 1.02e-65) {
tmp = R * hypot(phi1, -lambda2);
} else if (phi2 <= 1.3e-16) {
tmp = t_0;
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * Math.hypot(lambda1, phi1);
double tmp;
if (phi2 <= 7.5e-94) {
tmp = t_0;
} else if (phi2 <= 1.02e-65) {
tmp = R * Math.hypot(phi1, -lambda2);
} else if (phi2 <= 1.3e-16) {
tmp = t_0;
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = R * math.hypot(lambda1, phi1) tmp = 0 if phi2 <= 7.5e-94: tmp = t_0 elif phi2 <= 1.02e-65: tmp = R * math.hypot(phi1, -lambda2) elif phi2 <= 1.3e-16: tmp = t_0 else: tmp = phi2 * (R - (phi1 * (R / phi2))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(R * hypot(lambda1, phi1)) tmp = 0.0 if (phi2 <= 7.5e-94) tmp = t_0; elseif (phi2 <= 1.02e-65) tmp = Float64(R * hypot(phi1, Float64(-lambda2))); elseif (phi2 <= 1.3e-16) tmp = t_0; else tmp = Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = R * hypot(lambda1, phi1); tmp = 0.0; if (phi2 <= 7.5e-94) tmp = t_0; elseif (phi2 <= 1.02e-65) tmp = R * hypot(phi1, -lambda2); elseif (phi2 <= 1.3e-16) tmp = t_0; else tmp = phi2 * (R - (phi1 * (R / phi2))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(R * N[Sqrt[lambda1 ^ 2 + phi1 ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, 7.5e-94], t$95$0, If[LessEqual[phi2, 1.02e-65], N[(R * N[Sqrt[phi1 ^ 2 + (-lambda2) ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[phi2, 1.3e-16], t$95$0, N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := R \cdot \mathsf{hypot}\left(\lambda_1, \phi_1\right)\\
\mathbf{if}\;\phi_2 \leq 7.5 \cdot 10^{-94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 1.02 \cdot 10^{-65}:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\phi_1, -\lambda_2\right)\\
\mathbf{elif}\;\phi_2 \leq 1.3 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)\\
\end{array}
\end{array}
if phi2 < 7.5000000000000003e-94 or 1.02000000000000004e-65 < phi2 < 1.2999999999999999e-16Initial program 63.7%
hypot-define96.4%
Simplified96.4%
Taylor expanded in phi2 around 0 56.0%
+-commutative56.0%
unpow256.0%
unpow256.0%
unpow256.0%
unswap-sqr56.0%
hypot-define82.7%
Simplified82.7%
add-cube-cbrt81.8%
pow381.8%
Applied egg-rr81.8%
pow1/338.6%
*-commutative38.6%
sub-neg38.6%
add-sqr-sqrt18.3%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod20.3%
add-sqr-sqrt38.6%
Applied egg-rr38.6%
Taylor expanded in phi1 around 0 37.6%
+-commutative37.6%
Simplified37.6%
Taylor expanded in lambda2 around 0 42.3%
unpow242.3%
unpow242.3%
hypot-define61.1%
Simplified61.1%
if 7.5000000000000003e-94 < phi2 < 1.02000000000000004e-65Initial program 28.6%
hypot-define100.0%
Simplified100.0%
Taylor expanded in phi2 around 0 28.6%
+-commutative28.6%
unpow228.6%
unpow228.6%
unpow228.6%
unswap-sqr28.6%
hypot-define100.0%
Simplified100.0%
Taylor expanded in lambda1 around 0 76.4%
mul-1-neg76.4%
distribute-lft-neg-out76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in phi1 around 0 66.7%
Simplified66.7%
if 1.2999999999999999e-16 < phi2 Initial program 60.8%
hypot-define95.2%
Simplified95.2%
Taylor expanded in phi2 around inf 64.6%
mul-1-neg64.6%
unsub-neg64.6%
*-commutative64.6%
associate-/l*66.5%
Simplified66.5%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* R (hypot lambda1 phi1))))
(if (<= phi2 1.4e-93)
t_0
(if (<= phi2 5.5e-67)
(* R lambda2)
(if (<= phi2 4.8e-17) t_0 (* phi2 (- R (* phi1 (/ R phi2)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * hypot(lambda1, phi1);
double tmp;
if (phi2 <= 1.4e-93) {
tmp = t_0;
} else if (phi2 <= 5.5e-67) {
tmp = R * lambda2;
} else if (phi2 <= 4.8e-17) {
tmp = t_0;
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * Math.hypot(lambda1, phi1);
double tmp;
if (phi2 <= 1.4e-93) {
tmp = t_0;
} else if (phi2 <= 5.5e-67) {
tmp = R * lambda2;
} else if (phi2 <= 4.8e-17) {
tmp = t_0;
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = R * math.hypot(lambda1, phi1) tmp = 0 if phi2 <= 1.4e-93: tmp = t_0 elif phi2 <= 5.5e-67: tmp = R * lambda2 elif phi2 <= 4.8e-17: tmp = t_0 else: tmp = phi2 * (R - (phi1 * (R / phi2))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(R * hypot(lambda1, phi1)) tmp = 0.0 if (phi2 <= 1.4e-93) tmp = t_0; elseif (phi2 <= 5.5e-67) tmp = Float64(R * lambda2); elseif (phi2 <= 4.8e-17) tmp = t_0; else tmp = Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = R * hypot(lambda1, phi1); tmp = 0.0; if (phi2 <= 1.4e-93) tmp = t_0; elseif (phi2 <= 5.5e-67) tmp = R * lambda2; elseif (phi2 <= 4.8e-17) tmp = t_0; else tmp = phi2 * (R - (phi1 * (R / phi2))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(R * N[Sqrt[lambda1 ^ 2 + phi1 ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, 1.4e-93], t$95$0, If[LessEqual[phi2, 5.5e-67], N[(R * lambda2), $MachinePrecision], If[LessEqual[phi2, 4.8e-17], t$95$0, N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := R \cdot \mathsf{hypot}\left(\lambda_1, \phi_1\right)\\
\mathbf{if}\;\phi_2 \leq 1.4 \cdot 10^{-93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 5.5 \cdot 10^{-67}:\\
\;\;\;\;R \cdot \lambda_2\\
\mathbf{elif}\;\phi_2 \leq 4.8 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)\\
\end{array}
\end{array}
if phi2 < 1.39999999999999999e-93 or 5.5000000000000003e-67 < phi2 < 4.79999999999999973e-17Initial program 63.7%
hypot-define96.4%
Simplified96.4%
Taylor expanded in phi2 around 0 56.0%
+-commutative56.0%
unpow256.0%
unpow256.0%
unpow256.0%
unswap-sqr56.0%
hypot-define82.7%
Simplified82.7%
add-cube-cbrt81.8%
pow381.8%
Applied egg-rr81.8%
pow1/338.6%
*-commutative38.6%
sub-neg38.6%
add-sqr-sqrt18.3%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod20.3%
add-sqr-sqrt38.6%
Applied egg-rr38.6%
Taylor expanded in phi1 around 0 37.6%
+-commutative37.6%
Simplified37.6%
Taylor expanded in lambda2 around 0 42.3%
unpow242.3%
unpow242.3%
hypot-define61.1%
Simplified61.1%
if 1.39999999999999999e-93 < phi2 < 5.5000000000000003e-67Initial program 28.6%
hypot-define100.0%
Simplified100.0%
Taylor expanded in phi2 around 0 28.6%
+-commutative28.6%
unpow228.6%
unpow228.6%
unpow228.6%
unswap-sqr28.6%
hypot-define100.0%
Simplified100.0%
Taylor expanded in lambda2 around inf 39.0%
associate-*r*38.8%
Simplified38.8%
Taylor expanded in phi1 around 0 41.9%
Simplified41.9%
if 4.79999999999999973e-17 < phi2 Initial program 60.8%
hypot-define95.2%
Simplified95.2%
Taylor expanded in phi2 around inf 64.6%
mul-1-neg64.6%
unsub-neg64.6%
*-commutative64.6%
associate-/l*66.5%
Simplified66.5%
Final simplification61.6%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 0.000175) (* R (hypot phi1 (- lambda1 lambda2))) (* phi2 (- R (* phi1 (/ R phi2))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 0.000175) {
tmp = R * hypot(phi1, (lambda1 - lambda2));
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 0.000175) {
tmp = R * Math.hypot(phi1, (lambda1 - lambda2));
} else {
tmp = phi2 * (R - (phi1 * (R / phi2)));
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 0.000175: tmp = R * math.hypot(phi1, (lambda1 - lambda2)) else: tmp = phi2 * (R - (phi1 * (R / phi2))) return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 0.000175) tmp = Float64(R * hypot(phi1, Float64(lambda1 - lambda2))); else tmp = Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 0.000175) tmp = R * hypot(phi1, (lambda1 - lambda2)); else tmp = phi2 * (R - (phi1 * (R / phi2))); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 0.000175], N[(R * N[Sqrt[phi1 ^ 2 + N[(lambda1 - lambda2), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 0.000175:\\
\;\;\;\;R \cdot \mathsf{hypot}\left(\phi_1, \lambda_1 - \lambda_2\right)\\
\mathbf{else}:\\
\;\;\;\;\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)\\
\end{array}
\end{array}
if phi2 < 1.74999999999999998e-4Initial program 62.5%
hypot-define96.6%
Simplified96.6%
Taylor expanded in phi1 around 0 83.0%
Taylor expanded in phi2 around 0 54.1%
unpow254.1%
unpow254.1%
hypot-define77.4%
Simplified77.4%
if 1.74999999999999998e-4 < phi2 Initial program 60.1%
hypot-define95.1%
Simplified95.1%
Taylor expanded in phi2 around inf 63.9%
mul-1-neg63.9%
unsub-neg63.9%
*-commutative63.9%
associate-/l*65.9%
Simplified65.9%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* R (- lambda1))) (t_1 (* R (- phi1))))
(if (<= phi2 -3.25e-282)
t_1
(if (<= phi2 6.1e-294)
t_0
(if (<= phi2 9.5e-236)
t_1
(if (<= phi2 2.4e-157)
(* R lambda2)
(if (<= phi2 8.2e-98)
t_1
(if (<= phi2 5.5e-30)
(* R lambda2)
(if (<= phi2 3.6e-16)
t_0
(if (<= phi2 1.68e+66) t_1 (* R phi2)))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * -lambda1;
double t_1 = R * -phi1;
double tmp;
if (phi2 <= -3.25e-282) {
tmp = t_1;
} else if (phi2 <= 6.1e-294) {
tmp = t_0;
} else if (phi2 <= 9.5e-236) {
tmp = t_1;
} else if (phi2 <= 2.4e-157) {
tmp = R * lambda2;
} else if (phi2 <= 8.2e-98) {
tmp = t_1;
} else if (phi2 <= 5.5e-30) {
tmp = R * lambda2;
} else if (phi2 <= 3.6e-16) {
tmp = t_0;
} else if (phi2 <= 1.68e+66) {
tmp = t_1;
} else {
tmp = R * phi2;
}
return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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) :: t_1
real(8) :: tmp
t_0 = r * -lambda1
t_1 = r * -phi1
if (phi2 <= (-3.25d-282)) then
tmp = t_1
else if (phi2 <= 6.1d-294) then
tmp = t_0
else if (phi2 <= 9.5d-236) then
tmp = t_1
else if (phi2 <= 2.4d-157) then
tmp = r * lambda2
else if (phi2 <= 8.2d-98) then
tmp = t_1
else if (phi2 <= 5.5d-30) then
tmp = r * lambda2
else if (phi2 <= 3.6d-16) then
tmp = t_0
else if (phi2 <= 1.68d+66) then
tmp = t_1
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 t_0 = R * -lambda1;
double t_1 = R * -phi1;
double tmp;
if (phi2 <= -3.25e-282) {
tmp = t_1;
} else if (phi2 <= 6.1e-294) {
tmp = t_0;
} else if (phi2 <= 9.5e-236) {
tmp = t_1;
} else if (phi2 <= 2.4e-157) {
tmp = R * lambda2;
} else if (phi2 <= 8.2e-98) {
tmp = t_1;
} else if (phi2 <= 5.5e-30) {
tmp = R * lambda2;
} else if (phi2 <= 3.6e-16) {
tmp = t_0;
} else if (phi2 <= 1.68e+66) {
tmp = t_1;
} else {
tmp = R * phi2;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = R * -lambda1 t_1 = R * -phi1 tmp = 0 if phi2 <= -3.25e-282: tmp = t_1 elif phi2 <= 6.1e-294: tmp = t_0 elif phi2 <= 9.5e-236: tmp = t_1 elif phi2 <= 2.4e-157: tmp = R * lambda2 elif phi2 <= 8.2e-98: tmp = t_1 elif phi2 <= 5.5e-30: tmp = R * lambda2 elif phi2 <= 3.6e-16: tmp = t_0 elif phi2 <= 1.68e+66: tmp = t_1 else: tmp = R * phi2 return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(R * Float64(-lambda1)) t_1 = Float64(R * Float64(-phi1)) tmp = 0.0 if (phi2 <= -3.25e-282) tmp = t_1; elseif (phi2 <= 6.1e-294) tmp = t_0; elseif (phi2 <= 9.5e-236) tmp = t_1; elseif (phi2 <= 2.4e-157) tmp = Float64(R * lambda2); elseif (phi2 <= 8.2e-98) tmp = t_1; elseif (phi2 <= 5.5e-30) tmp = Float64(R * lambda2); elseif (phi2 <= 3.6e-16) tmp = t_0; elseif (phi2 <= 1.68e+66) tmp = t_1; else tmp = Float64(R * phi2); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = R * -lambda1; t_1 = R * -phi1; tmp = 0.0; if (phi2 <= -3.25e-282) tmp = t_1; elseif (phi2 <= 6.1e-294) tmp = t_0; elseif (phi2 <= 9.5e-236) tmp = t_1; elseif (phi2 <= 2.4e-157) tmp = R * lambda2; elseif (phi2 <= 8.2e-98) tmp = t_1; elseif (phi2 <= 5.5e-30) tmp = R * lambda2; elseif (phi2 <= 3.6e-16) tmp = t_0; elseif (phi2 <= 1.68e+66) tmp = t_1; else tmp = R * phi2; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(R * (-lambda1)), $MachinePrecision]}, Block[{t$95$1 = N[(R * (-phi1)), $MachinePrecision]}, If[LessEqual[phi2, -3.25e-282], t$95$1, If[LessEqual[phi2, 6.1e-294], t$95$0, If[LessEqual[phi2, 9.5e-236], t$95$1, If[LessEqual[phi2, 2.4e-157], N[(R * lambda2), $MachinePrecision], If[LessEqual[phi2, 8.2e-98], t$95$1, If[LessEqual[phi2, 5.5e-30], N[(R * lambda2), $MachinePrecision], If[LessEqual[phi2, 3.6e-16], t$95$0, If[LessEqual[phi2, 1.68e+66], t$95$1, N[(R * phi2), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := R \cdot \left(-\lambda_1\right)\\
t_1 := R \cdot \left(-\phi_1\right)\\
\mathbf{if}\;\phi_2 \leq -3.25 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 6.1 \cdot 10^{-294}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 9.5 \cdot 10^{-236}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 2.4 \cdot 10^{-157}:\\
\;\;\;\;R \cdot \lambda_2\\
\mathbf{elif}\;\phi_2 \leq 8.2 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\phi_2 \leq 5.5 \cdot 10^{-30}:\\
\;\;\;\;R \cdot \lambda_2\\
\mathbf{elif}\;\phi_2 \leq 3.6 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\phi_2 \leq 1.68 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;R \cdot \phi_2\\
\end{array}
\end{array}
if phi2 < -3.25000000000000006e-282 or 6.1000000000000003e-294 < phi2 < 9.50000000000000065e-236 or 2.4e-157 < phi2 < 8.1999999999999996e-98 or 3.59999999999999983e-16 < phi2 < 1.67999999999999993e66Initial program 61.8%
hypot-define95.6%
Simplified95.6%
Taylor expanded in phi1 around -inf 25.2%
mul-1-neg25.2%
*-commutative25.2%
distribute-rgt-neg-in25.2%
Simplified25.2%
if -3.25000000000000006e-282 < phi2 < 6.1000000000000003e-294 or 5.49999999999999976e-30 < phi2 < 3.59999999999999983e-16Initial program 74.8%
hypot-define99.9%
Simplified99.9%
Taylor expanded in lambda1 around -inf 28.9%
mul-1-neg28.9%
associate-*r*28.9%
distribute-lft-neg-in28.9%
+-commutative28.9%
Simplified28.9%
Taylor expanded in phi1 around 0 28.6%
mul-1-neg28.6%
distribute-rgt-neg-in28.6%
*-commutative28.6%
Simplified28.6%
Taylor expanded in phi2 around 0 28.6%
if 9.50000000000000065e-236 < phi2 < 2.4e-157 or 8.1999999999999996e-98 < phi2 < 5.49999999999999976e-30Initial program 60.9%
hypot-define100.0%
Simplified100.0%
Taylor expanded in phi2 around 0 60.9%
+-commutative60.9%
unpow260.9%
unpow260.9%
unpow260.9%
unswap-sqr60.9%
hypot-define100.0%
Simplified100.0%
Taylor expanded in lambda2 around inf 22.8%
associate-*r*22.8%
Simplified22.8%
Taylor expanded in phi1 around 0 18.5%
Simplified18.5%
if 1.67999999999999993e66 < phi2 Initial program 58.1%
hypot-define94.1%
Simplified94.1%
Taylor expanded in phi2 around inf 63.7%
*-commutative63.7%
Simplified63.7%
Final simplification30.7%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(let* ((t_0 (* R (- lambda1))))
(if (<= lambda1 -1.5e+136)
t_0
(if (<= lambda1 -2.1e+62)
(* phi2 (- R (* phi1 (/ R phi2))))
(if (<= lambda1 -4.7e+58)
t_0
(if (<= lambda1 1.3e-215)
(* phi2 (- R (/ (* R phi1) phi2)))
(* R (+ lambda1 lambda2))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double t_0 = R * -lambda1;
double tmp;
if (lambda1 <= -1.5e+136) {
tmp = t_0;
} else if (lambda1 <= -2.1e+62) {
tmp = phi2 * (R - (phi1 * (R / phi2)));
} else if (lambda1 <= -4.7e+58) {
tmp = t_0;
} else if (lambda1 <= 1.3e-215) {
tmp = phi2 * (R - ((R * phi1) / phi2));
} else {
tmp = R * (lambda1 + lambda2);
}
return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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
if (lambda1 <= (-1.5d+136)) then
tmp = t_0
else if (lambda1 <= (-2.1d+62)) then
tmp = phi2 * (r - (phi1 * (r / phi2)))
else if (lambda1 <= (-4.7d+58)) then
tmp = t_0
else if (lambda1 <= 1.3d-215) then
tmp = phi2 * (r - ((r * phi1) / phi2))
else
tmp = r * (lambda1 + lambda2)
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;
double tmp;
if (lambda1 <= -1.5e+136) {
tmp = t_0;
} else if (lambda1 <= -2.1e+62) {
tmp = phi2 * (R - (phi1 * (R / phi2)));
} else if (lambda1 <= -4.7e+58) {
tmp = t_0;
} else if (lambda1 <= 1.3e-215) {
tmp = phi2 * (R - ((R * phi1) / phi2));
} else {
tmp = R * (lambda1 + lambda2);
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): t_0 = R * -lambda1 tmp = 0 if lambda1 <= -1.5e+136: tmp = t_0 elif lambda1 <= -2.1e+62: tmp = phi2 * (R - (phi1 * (R / phi2))) elif lambda1 <= -4.7e+58: tmp = t_0 elif lambda1 <= 1.3e-215: tmp = phi2 * (R - ((R * phi1) / phi2)) else: tmp = R * (lambda1 + lambda2) return tmp
function code(R, lambda1, lambda2, phi1, phi2) t_0 = Float64(R * Float64(-lambda1)) tmp = 0.0 if (lambda1 <= -1.5e+136) tmp = t_0; elseif (lambda1 <= -2.1e+62) tmp = Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))); elseif (lambda1 <= -4.7e+58) tmp = t_0; elseif (lambda1 <= 1.3e-215) tmp = Float64(phi2 * Float64(R - Float64(Float64(R * phi1) / phi2))); else tmp = Float64(R * Float64(lambda1 + lambda2)); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) t_0 = R * -lambda1; tmp = 0.0; if (lambda1 <= -1.5e+136) tmp = t_0; elseif (lambda1 <= -2.1e+62) tmp = phi2 * (R - (phi1 * (R / phi2))); elseif (lambda1 <= -4.7e+58) tmp = t_0; elseif (lambda1 <= 1.3e-215) tmp = phi2 * (R - ((R * phi1) / phi2)); else tmp = R * (lambda1 + lambda2); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(R * (-lambda1)), $MachinePrecision]}, If[LessEqual[lambda1, -1.5e+136], t$95$0, If[LessEqual[lambda1, -2.1e+62], N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[lambda1, -4.7e+58], t$95$0, If[LessEqual[lambda1, 1.3e-215], N[(phi2 * N[(R - N[(N[(R * phi1), $MachinePrecision] / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(lambda1 + lambda2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := R \cdot \left(-\lambda_1\right)\\
\mathbf{if}\;\lambda_1 \leq -1.5 \cdot 10^{+136}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq -2.1 \cdot 10^{+62}:\\
\;\;\;\;\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)\\
\mathbf{elif}\;\lambda_1 \leq -4.7 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\lambda_1 \leq 1.3 \cdot 10^{-215}:\\
\;\;\;\;\phi_2 \cdot \left(R - \frac{R \cdot \phi_1}{\phi_2}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(\lambda_1 + \lambda_2\right)\\
\end{array}
\end{array}
if lambda1 < -1.49999999999999989e136 or -2.1e62 < lambda1 < -4.69999999999999972e58Initial program 45.6%
hypot-define91.6%
Simplified91.6%
Taylor expanded in lambda1 around -inf 42.8%
mul-1-neg42.8%
associate-*r*42.8%
distribute-lft-neg-in42.8%
+-commutative42.8%
Simplified42.8%
Taylor expanded in phi1 around 0 46.6%
mul-1-neg46.6%
distribute-rgt-neg-in46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in phi2 around 0 59.2%
if -1.49999999999999989e136 < lambda1 < -2.1e62Initial program 60.7%
hypot-define99.9%
Simplified99.9%
Taylor expanded in phi2 around inf 43.2%
mul-1-neg43.2%
unsub-neg43.2%
*-commutative43.2%
associate-/l*43.9%
Simplified43.9%
if -4.69999999999999972e58 < lambda1 < 1.3e-215Initial program 74.3%
hypot-define96.4%
Simplified96.4%
Taylor expanded in phi2 around inf 35.5%
associate-*r/35.5%
mul-1-neg35.5%
*-commutative35.5%
Simplified35.5%
if 1.3e-215 < lambda1 Initial program 58.6%
hypot-define97.9%
Simplified97.9%
Taylor expanded in phi2 around 0 47.2%
+-commutative47.2%
unpow247.2%
unpow247.2%
unpow247.2%
unswap-sqr47.2%
hypot-define77.2%
Simplified77.2%
add-cube-cbrt76.3%
pow376.2%
Applied egg-rr76.2%
pow1/334.6%
*-commutative34.6%
sub-neg34.6%
add-sqr-sqrt17.2%
sqrt-unprod31.2%
sqr-neg31.2%
sqrt-unprod17.4%
add-sqr-sqrt34.6%
Applied egg-rr34.6%
Taylor expanded in phi1 around 0 33.8%
+-commutative33.8%
Simplified33.8%
Final simplification39.5%
(FPCore (R lambda1 lambda2 phi1 phi2)
:precision binary64
(if (<= lambda1 -1.9e+141)
(* R (- lambda1))
(if (<= lambda1 7e-216)
(* phi2 (- R (* R (/ phi1 phi2))))
(* R (+ lambda1 lambda2)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -1.9e+141) {
tmp = R * -lambda1;
} else if (lambda1 <= 7e-216) {
tmp = phi2 * (R - (R * (phi1 / phi2)));
} else {
tmp = R * (lambda1 + lambda2);
}
return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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 <= (-1.9d+141)) then
tmp = r * -lambda1
else if (lambda1 <= 7d-216) then
tmp = phi2 * (r - (r * (phi1 / phi2)))
else
tmp = r * (lambda1 + lambda2)
end if
code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (lambda1 <= -1.9e+141) {
tmp = R * -lambda1;
} else if (lambda1 <= 7e-216) {
tmp = phi2 * (R - (R * (phi1 / phi2)));
} else {
tmp = R * (lambda1 + lambda2);
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if lambda1 <= -1.9e+141: tmp = R * -lambda1 elif lambda1 <= 7e-216: tmp = phi2 * (R - (R * (phi1 / phi2))) else: tmp = R * (lambda1 + lambda2) return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (lambda1 <= -1.9e+141) tmp = Float64(R * Float64(-lambda1)); elseif (lambda1 <= 7e-216) tmp = Float64(phi2 * Float64(R - Float64(R * Float64(phi1 / phi2)))); else tmp = Float64(R * Float64(lambda1 + lambda2)); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (lambda1 <= -1.9e+141) tmp = R * -lambda1; elseif (lambda1 <= 7e-216) tmp = phi2 * (R - (R * (phi1 / phi2))); else tmp = R * (lambda1 + lambda2); end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[lambda1, -1.9e+141], N[(R * (-lambda1)), $MachinePrecision], If[LessEqual[lambda1, 7e-216], N[(phi2 * N[(R - N[(R * N[(phi1 / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(lambda1 + lambda2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\lambda_1 \leq -1.9 \cdot 10^{+141}:\\
\;\;\;\;R \cdot \left(-\lambda_1\right)\\
\mathbf{elif}\;\lambda_1 \leq 7 \cdot 10^{-216}:\\
\;\;\;\;\phi_2 \cdot \left(R - R \cdot \frac{\phi_1}{\phi_2}\right)\\
\mathbf{else}:\\
\;\;\;\;R \cdot \left(\lambda_1 + \lambda_2\right)\\
\end{array}
\end{array}
if lambda1 < -1.89999999999999988e141Initial program 44.0%
hypot-define91.0%
Simplified91.0%
Taylor expanded in lambda1 around -inf 43.4%
mul-1-neg43.4%
associate-*r*43.4%
distribute-lft-neg-in43.4%
+-commutative43.4%
Simplified43.4%
Taylor expanded in phi1 around 0 47.3%
mul-1-neg47.3%
distribute-rgt-neg-in47.3%
*-commutative47.3%
Simplified47.3%
Taylor expanded in phi2 around 0 60.4%
if -1.89999999999999988e141 < lambda1 < 6.99999999999999965e-216Initial program 72.6%
hypot-define96.9%
Simplified96.9%
Taylor expanded in phi1 around 0 87.4%
Taylor expanded in phi2 around inf 35.4%
mul-1-neg35.4%
unsub-neg35.4%
associate-/l*32.6%
Simplified32.6%
if 6.99999999999999965e-216 < lambda1 Initial program 58.6%
hypot-define97.9%
Simplified97.9%
Taylor expanded in phi2 around 0 47.2%
+-commutative47.2%
unpow247.2%
unpow247.2%
unpow247.2%
unswap-sqr47.2%
hypot-define77.2%
Simplified77.2%
add-cube-cbrt76.3%
pow376.2%
Applied egg-rr76.2%
pow1/334.6%
*-commutative34.6%
sub-neg34.6%
add-sqr-sqrt17.2%
sqrt-unprod31.2%
sqr-neg31.2%
sqrt-unprod17.4%
add-sqr-sqrt34.6%
Applied egg-rr34.6%
Taylor expanded in phi1 around 0 33.8%
+-commutative33.8%
Simplified33.8%
Final simplification37.9%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 3.4e-95) (* R (- lambda1)) (if (<= phi2 3e-11) (* R lambda2) (* R phi2))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 3.4e-95) {
tmp = R * -lambda1;
} else if (phi2 <= 3e-11) {
tmp = R * lambda2;
} else {
tmp = R * phi2;
}
return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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 <= 3.4d-95) then
tmp = r * -lambda1
else if (phi2 <= 3d-11) then
tmp = r * lambda2
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 (phi2 <= 3.4e-95) {
tmp = R * -lambda1;
} else if (phi2 <= 3e-11) {
tmp = R * lambda2;
} else {
tmp = R * phi2;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 3.4e-95: tmp = R * -lambda1 elif phi2 <= 3e-11: tmp = R * lambda2 else: tmp = R * phi2 return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 3.4e-95) tmp = Float64(R * Float64(-lambda1)); elseif (phi2 <= 3e-11) tmp = Float64(R * lambda2); else tmp = Float64(R * phi2); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 3.4e-95) tmp = R * -lambda1; elseif (phi2 <= 3e-11) tmp = R * lambda2; else tmp = R * phi2; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 3.4e-95], N[(R * (-lambda1)), $MachinePrecision], If[LessEqual[phi2, 3e-11], N[(R * lambda2), $MachinePrecision], N[(R * phi2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 3.4 \cdot 10^{-95}:\\
\;\;\;\;R \cdot \left(-\lambda_1\right)\\
\mathbf{elif}\;\phi_2 \leq 3 \cdot 10^{-11}:\\
\;\;\;\;R \cdot \lambda_2\\
\mathbf{else}:\\
\;\;\;\;R \cdot \phi_2\\
\end{array}
\end{array}
if phi2 < 3.39999999999999993e-95Initial program 64.6%
hypot-define96.1%
Simplified96.1%
Taylor expanded in lambda1 around -inf 21.7%
mul-1-neg21.7%
associate-*r*21.7%
distribute-lft-neg-in21.7%
+-commutative21.7%
Simplified21.7%
Taylor expanded in phi1 around 0 19.8%
mul-1-neg19.8%
distribute-rgt-neg-in19.8%
*-commutative19.8%
Simplified19.8%
Taylor expanded in phi2 around 0 17.3%
if 3.39999999999999993e-95 < phi2 < 3e-11Initial program 43.8%
hypot-define100.0%
Simplified100.0%
Taylor expanded in phi2 around 0 43.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
unpow243.8%
unswap-sqr43.8%
hypot-define100.0%
Simplified100.0%
Taylor expanded in lambda2 around inf 25.8%
associate-*r*25.7%
Simplified25.7%
Taylor expanded in phi1 around 0 26.1%
Simplified26.1%
if 3e-11 < phi2 Initial program 60.8%
hypot-define95.2%
Simplified95.2%
Taylor expanded in phi2 around inf 53.8%
*-commutative53.8%
Simplified53.8%
Final simplification25.3%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* phi2 (- R (* phi1 (/ R phi2)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return phi2 * (R - (phi1 * (R / phi2)));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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 = phi2 * (r - (phi1 * (r / phi2)))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return phi2 * (R - (phi1 * (R / phi2)));
}
def code(R, lambda1, lambda2, phi1, phi2): return phi2 * (R - (phi1 * (R / phi2)))
function code(R, lambda1, lambda2, phi1, phi2) return Float64(phi2 * Float64(R - Float64(phi1 * Float64(R / phi2)))) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = phi2 * (R - (phi1 * (R / phi2))); end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(phi2 * N[(R - N[(phi1 * N[(R / phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\phi_2 \cdot \left(R - \phi_1 \cdot \frac{R}{\phi_2}\right)
\end{array}
Initial program 62.1%
hypot-define96.3%
Simplified96.3%
Taylor expanded in phi2 around inf 28.5%
mul-1-neg28.5%
unsub-neg28.5%
*-commutative28.5%
associate-/l*26.4%
Simplified26.4%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (if (<= phi2 4.8e-29) (* R lambda2) (* R phi2)))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
double tmp;
if (phi2 <= 4.8e-29) {
tmp = R * lambda2;
} else {
tmp = R * phi2;
}
return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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.8d-29) then
tmp = r * lambda2
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 (phi2 <= 4.8e-29) {
tmp = R * lambda2;
} else {
tmp = R * phi2;
}
return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2): tmp = 0 if phi2 <= 4.8e-29: tmp = R * lambda2 else: tmp = R * phi2 return tmp
function code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0 if (phi2 <= 4.8e-29) tmp = Float64(R * lambda2); else tmp = Float64(R * phi2); end return tmp end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2) tmp = 0.0; if (phi2 <= 4.8e-29) tmp = R * lambda2; else tmp = R * phi2; end tmp_2 = tmp; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, 4.8e-29], N[(R * lambda2), $MachinePrecision], N[(R * phi2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\phi_2 \leq 4.8 \cdot 10^{-29}:\\
\;\;\;\;R \cdot \lambda_2\\
\mathbf{else}:\\
\;\;\;\;R \cdot \phi_2\\
\end{array}
\end{array}
if phi2 < 4.79999999999999984e-29Initial program 62.7%
hypot-define96.4%
Simplified96.4%
Taylor expanded in phi2 around 0 55.0%
+-commutative55.0%
unpow255.0%
unpow255.0%
unpow255.0%
unswap-sqr55.0%
hypot-define82.9%
Simplified82.9%
Taylor expanded in lambda2 around inf 15.5%
associate-*r*15.5%
Simplified15.5%
Taylor expanded in phi1 around 0 14.3%
Simplified14.3%
if 4.79999999999999984e-29 < phi2 Initial program 59.9%
hypot-define95.7%
Simplified95.7%
Taylor expanded in phi2 around inf 48.7%
*-commutative48.7%
Simplified48.7%
Final simplification22.0%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* R lambda2))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * lambda2;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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 * lambda2
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * lambda2;
}
def code(R, lambda1, lambda2, phi1, phi2): return R * lambda2
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * lambda2) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * lambda2; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * lambda2), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \lambda_2
\end{array}
Initial program 62.1%
hypot-define96.3%
Simplified96.3%
Taylor expanded in phi2 around 0 50.4%
+-commutative50.4%
unpow250.4%
unpow250.4%
unpow250.4%
unswap-sqr50.4%
hypot-define75.4%
Simplified75.4%
Taylor expanded in lambda2 around inf 13.9%
associate-*r*13.9%
Simplified13.9%
Taylor expanded in phi1 around 0 13.7%
Simplified13.7%
Final simplification13.7%
(FPCore (R lambda1 lambda2 phi1 phi2) :precision binary64 (* R lambda1))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * lambda1;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
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 * lambda1
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
return R * lambda1;
}
def code(R, lambda1, lambda2, phi1, phi2): return R * lambda1
function code(R, lambda1, lambda2, phi1, phi2) return Float64(R * lambda1) end
function tmp = code(R, lambda1, lambda2, phi1, phi2) tmp = R * lambda1; end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * lambda1), $MachinePrecision]
\begin{array}{l}
\\
R \cdot \lambda_1
\end{array}
Initial program 62.1%
hypot-define96.3%
Simplified96.3%
Taylor expanded in lambda1 around inf 17.6%
*-commutative17.6%
associate-*r*17.5%
*-commutative17.5%
associate-*l*17.6%
+-commutative17.6%
Simplified17.6%
Taylor expanded in phi1 around 0 16.1%
associate-*r*16.1%
*-commutative16.1%
Simplified16.1%
Taylor expanded in phi2 around 0 14.1%
*-commutative14.1%
Simplified14.1%
Final simplification14.1%
herbie shell --seed 2024107
(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))))))