
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 1e-38)
(* t_0 (* 2.0 (* (/ (* c0 d) (* (* w h) D)) (/ d D))))
(if (<= t_2 INFINITY)
(pow (* (* (/ d D) (sqrt (* 2.0 (/ c0 (* w h))))) (sqrt t_0)) 2.0)
(/
(*
c0
(fma 0.5 (/ (* w (* h (pow M 2.0))) (* c0 (pow (/ d D) 2.0))) 0.0))
(* 2.0 w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 1e-38) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((((d / D) * sqrt((2.0 * (c0 / (w * h))))) * sqrt(t_0)), 2.0);
} else {
tmp = (c0 * fma(0.5, ((w * (h * pow(M, 2.0))) / (c0 * pow((d / D), 2.0))), 0.0)) / (2.0 * w);
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= 1e-38) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(Float64(w * h) * D)) * Float64(d / D)))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(d / D) * sqrt(Float64(2.0 * Float64(c0 / Float64(w * h))))) * sqrt(t_0)) ^ 2.0; else tmp = Float64(Float64(c0 * fma(0.5, Float64(Float64(w * Float64(h * (M ^ 2.0))) / Float64(c0 * (Float64(d / D) ^ 2.0))), 0.0)) / Float64(2.0 * w)); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-38], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(c0 * N[(0.5 * N[(N[(w * N[(h * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq 10^{-38}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\left(\frac{d}{D} \cdot \sqrt{2 \cdot \frac{c0}{w \cdot h}}\right) \cdot \sqrt{t_0}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \mathsf{fma}\left(0.5, \frac{w \cdot \left(h \cdot {M}^{2}\right)}{c0 \cdot {\left(\frac{d}{D}\right)}^{2}}, 0\right)}{2 \cdot w}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 9.9999999999999996e-39Initial program 73.8%
times-frac66.1%
Simplified66.3%
Taylor expanded in c0 around inf 71.5%
associate-*r*67.9%
*-commutative67.9%
*-commutative67.9%
associate-/r*67.8%
associate-*l/67.8%
times-frac64.3%
unpow264.3%
associate-*r/64.3%
unpow264.3%
associate-/l/66.0%
associate-*r/66.0%
associate-*l/66.0%
unpow266.0%
Simplified66.0%
associate-*l/67.9%
Applied egg-rr67.9%
associate-*l/66.0%
pow266.0%
associate-*r*69.6%
associate-/r*69.6%
Applied egg-rr69.6%
frac-times75.0%
Applied egg-rr75.0%
if 9.9999999999999996e-39 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 80.5%
times-frac77.1%
Simplified80.4%
Taylor expanded in c0 around inf 80.5%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
associate-/r*83.7%
associate-*l/83.6%
times-frac83.4%
unpow283.4%
associate-*r/83.5%
unpow283.5%
associate-/l/83.5%
associate-*r/83.5%
associate-*l/83.5%
unpow283.5%
Simplified83.5%
associate-*l/83.5%
Applied egg-rr83.5%
associate-*l/83.5%
pow283.5%
add-sqr-sqrt83.5%
pow283.5%
Applied egg-rr99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*r*0.0%
times-frac0.1%
pow20.1%
Applied egg-rr0.1%
Taylor expanded in c0 around -inf 2.2%
+-commutative2.2%
fma-def2.2%
*-commutative2.2%
associate-/l*1.9%
associate-*r/2.0%
unpow22.0%
unpow22.0%
times-frac3.1%
unpow23.1%
associate-*r*3.1%
Simplified38.5%
pow238.5%
add-exp-log27.8%
*-commutative27.8%
*-commutative27.8%
pow227.8%
Applied egg-rr27.8%
associate-*l/30.9%
rem-exp-log41.7%
pow241.7%
associate-*l*44.7%
pow244.7%
mul0-rgt44.7%
*-commutative44.7%
Applied egg-rr44.7%
Final simplification57.4%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 1e-38)
(* t_0 (* 2.0 (* (/ (* c0 d) (* (* w h) D)) (/ d D))))
(if (<= t_2 INFINITY)
(pow (* (* (/ d D) (sqrt (* 2.0 (/ c0 (* w h))))) (sqrt t_0)) 2.0)
(/ (* 0.25 (pow D 2.0)) (/ (pow d 2.0) (* h (pow M 2.0))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 1e-38) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((((d / D) * sqrt((2.0 * (c0 / (w * h))))) * sqrt(t_0)), 2.0);
} else {
tmp = (0.25 * pow(D, 2.0)) / (pow(d, 2.0) / (h * pow(M, 2.0)));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 1e-38) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((((d / D) * Math.sqrt((2.0 * (c0 / (w * h))))) * Math.sqrt(t_0)), 2.0);
} else {
tmp = (0.25 * Math.pow(D, 2.0)) / (Math.pow(d, 2.0) / (h * Math.pow(M, 2.0)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) t_2 = t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= 1e-38: tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))) elif t_2 <= math.inf: tmp = math.pow((((d / D) * math.sqrt((2.0 * (c0 / (w * h))))) * math.sqrt(t_0)), 2.0) else: tmp = (0.25 * math.pow(D, 2.0)) / (math.pow(d, 2.0) / (h * math.pow(M, 2.0))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= 1e-38) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(Float64(w * h) * D)) * Float64(d / D)))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(d / D) * sqrt(Float64(2.0 * Float64(c0 / Float64(w * h))))) * sqrt(t_0)) ^ 2.0; else tmp = Float64(Float64(0.25 * (D ^ 2.0)) / Float64((d ^ 2.0) / Float64(h * (M ^ 2.0)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= 1e-38) tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))); elseif (t_2 <= Inf) tmp = (((d / D) * sqrt((2.0 * (c0 / (w * h))))) * sqrt(t_0)) ^ 2.0; else tmp = (0.25 * (D ^ 2.0)) / ((d ^ 2.0) / (h * (M ^ 2.0))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-38], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(N[(0.25 * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq 10^{-38}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\left(\frac{d}{D} \cdot \sqrt{2 \cdot \frac{c0}{w \cdot h}}\right) \cdot \sqrt{t_0}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25 \cdot {D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 9.9999999999999996e-39Initial program 73.8%
times-frac66.1%
Simplified66.3%
Taylor expanded in c0 around inf 71.5%
associate-*r*67.9%
*-commutative67.9%
*-commutative67.9%
associate-/r*67.8%
associate-*l/67.8%
times-frac64.3%
unpow264.3%
associate-*r/64.3%
unpow264.3%
associate-/l/66.0%
associate-*r/66.0%
associate-*l/66.0%
unpow266.0%
Simplified66.0%
associate-*l/67.9%
Applied egg-rr67.9%
associate-*l/66.0%
pow266.0%
associate-*r*69.6%
associate-/r*69.6%
Applied egg-rr69.6%
frac-times75.0%
Applied egg-rr75.0%
if 9.9999999999999996e-39 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 80.5%
times-frac77.1%
Simplified80.4%
Taylor expanded in c0 around inf 80.5%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
associate-/r*83.7%
associate-*l/83.6%
times-frac83.4%
unpow283.4%
associate-*r/83.5%
unpow283.5%
associate-/l/83.5%
associate-*r/83.5%
associate-*l/83.5%
unpow283.5%
Simplified83.5%
associate-*l/83.5%
Applied egg-rr83.5%
associate-*l/83.5%
pow283.5%
add-sqr-sqrt83.5%
pow283.5%
Applied egg-rr99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*r*0.0%
times-frac0.1%
pow20.1%
Applied egg-rr0.1%
Taylor expanded in c0 around -inf 2.2%
+-commutative2.2%
fma-def2.2%
*-commutative2.2%
associate-/l*1.9%
associate-*r/2.0%
unpow22.0%
unpow22.0%
times-frac3.1%
unpow23.1%
associate-*r*3.1%
Simplified38.5%
Taylor expanded in c0 around 0 40.5%
associate-/l*40.6%
associate-*r/40.6%
*-commutative40.6%
Simplified40.6%
Final simplification54.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (/ (* c0 d) (* (* w h) D)) (/ d D))))
(* 0.25 (/ (* (* h (pow M 2.0)) (pow D 2.0)) (pow d 2.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = 0.25 * (((h * pow(M, 2.0)) * pow(D, 2.0)) / pow(d, 2.0));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = 0.25 * (((h * Math.pow(M, 2.0)) * Math.pow(D, 2.0)) / Math.pow(d, 2.0));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))) else: tmp = 0.25 * (((h * math.pow(M, 2.0)) * math.pow(D, 2.0)) / math.pow(d, 2.0)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(Float64(w * h) * D)) * Float64(d / D)))); else tmp = Float64(0.25 * Float64(Float64(Float64(h * (M ^ 2.0)) * (D ^ 2.0)) / (d ^ 2.0))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))); else tmp = 0.25 * (((h * (M ^ 2.0)) * (D ^ 2.0)) / (d ^ 2.0)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(N[(h * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}{{d}^{2}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.1%
times-frac69.9%
Simplified71.1%
Taylor expanded in c0 around inf 74.6%
associate-*r*72.3%
*-commutative72.3%
*-commutative72.3%
associate-/r*73.3%
associate-*l/73.3%
times-frac70.9%
unpow270.9%
associate-*r/70.9%
unpow270.9%
associate-/l/72.0%
associate-*r/72.1%
associate-*l/72.1%
unpow272.1%
Simplified72.1%
associate-*l/73.3%
Applied egg-rr73.3%
associate-*l/72.1%
pow272.1%
associate-*r*75.6%
associate-/r*75.6%
Applied egg-rr75.6%
frac-times78.0%
Applied egg-rr78.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*r*0.0%
times-frac0.1%
pow20.1%
Applied egg-rr0.1%
Taylor expanded in c0 around -inf 2.2%
+-commutative2.2%
fma-def2.2%
*-commutative2.2%
associate-/l*1.9%
associate-*r/2.0%
unpow22.0%
unpow22.0%
times-frac3.1%
unpow23.1%
associate-*r*3.1%
Simplified38.5%
Taylor expanded in c0 around 0 40.5%
Final simplification52.8%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (/ (* c0 d) (* (* w h) D)) (/ d D))))
(/ (* 0.25 (pow D 2.0)) (/ (pow d 2.0) (* h (pow M 2.0)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = (0.25 * pow(D, 2.0)) / (pow(d, 2.0) / (h * pow(M, 2.0)));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = (0.25 * Math.pow(D, 2.0)) / (Math.pow(d, 2.0) / (h * Math.pow(M, 2.0)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))) else: tmp = (0.25 * math.pow(D, 2.0)) / (math.pow(d, 2.0) / (h * math.pow(M, 2.0))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(Float64(w * h) * D)) * Float64(d / D)))); else tmp = Float64(Float64(0.25 * (D ^ 2.0)) / Float64((d ^ 2.0) / Float64(h * (M ^ 2.0)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))); else tmp = (0.25 * (D ^ 2.0)) / ((d ^ 2.0) / (h * (M ^ 2.0))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.25 * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25 \cdot {D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.1%
times-frac69.9%
Simplified71.1%
Taylor expanded in c0 around inf 74.6%
associate-*r*72.3%
*-commutative72.3%
*-commutative72.3%
associate-/r*73.3%
associate-*l/73.3%
times-frac70.9%
unpow270.9%
associate-*r/70.9%
unpow270.9%
associate-/l/72.0%
associate-*r/72.1%
associate-*l/72.1%
unpow272.1%
Simplified72.1%
associate-*l/73.3%
Applied egg-rr73.3%
associate-*l/72.1%
pow272.1%
associate-*r*75.6%
associate-/r*75.6%
Applied egg-rr75.6%
frac-times78.0%
Applied egg-rr78.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*r*0.0%
times-frac0.1%
pow20.1%
Applied egg-rr0.1%
Taylor expanded in c0 around -inf 2.2%
+-commutative2.2%
fma-def2.2%
*-commutative2.2%
associate-/l*1.9%
associate-*r/2.0%
unpow22.0%
unpow22.0%
times-frac3.1%
unpow23.1%
associate-*r*3.1%
Simplified38.5%
Taylor expanded in c0 around 0 40.5%
associate-/l*40.6%
associate-*r/40.6%
*-commutative40.6%
Simplified40.6%
Final simplification52.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (/ (* c0 d) (* (* w h) D)) (/ d D))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(Float64(w * h) * D)) * Float64(d / D)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * (((c0 * d) / ((w * h) * D)) * (d / D))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.1%
times-frac69.9%
Simplified71.1%
Taylor expanded in c0 around inf 74.6%
associate-*r*72.3%
*-commutative72.3%
*-commutative72.3%
associate-/r*73.3%
associate-*l/73.3%
times-frac70.9%
unpow270.9%
associate-*r/70.9%
unpow270.9%
associate-/l/72.0%
associate-*r/72.1%
associate-*l/72.1%
unpow272.1%
Simplified72.1%
associate-*l/73.3%
Applied egg-rr73.3%
associate-*l/72.1%
pow272.1%
associate-*r*75.6%
associate-/r*75.6%
Applied egg-rr75.6%
frac-times78.0%
Applied egg-rr78.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
times-frac0.0%
Simplified4.8%
Taylor expanded in c0 around -inf 1.9%
associate-*r*1.9%
neg-mul-11.9%
distribute-lft1-in1.9%
metadata-eval1.9%
mul0-lft36.6%
distribute-lft-neg-in36.6%
distribute-rgt-neg-in36.6%
metadata-eval36.6%
mul0-lft1.9%
metadata-eval1.9%
distribute-lft1-in1.9%
distribute-lft-in1.3%
associate-*r*0.7%
*-commutative0.7%
*-commutative0.7%
associate-*r/0.1%
Simplified36.6%
Taylor expanded in c0 around 0 40.5%
Final simplification52.8%
(FPCore (c0 w h D d M)
:precision binary64
(if (or (<= D 4.5e-256)
(not
(or (<= D 2.85e-210) (and (not (<= D 1.32e-138)) (<= D 9.8e-104)))))
(* (/ c0 (* 2.0 w)) (* 2.0 (* (/ d D) (* (/ c0 w) (/ (/ d D) h)))))
0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 4.5e-256) || !((D <= 2.85e-210) || (!(D <= 1.32e-138) && (D <= 9.8e-104)))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((c0 / w) * ((d / D) / h))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d <= 4.5d-256) .or. (.not. (d <= 2.85d-210) .or. (.not. (d <= 1.32d-138)) .and. (d <= 9.8d-104))) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((d_1 / d) * ((c0 / w) * ((d_1 / d) / h))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 4.5e-256) || !((D <= 2.85e-210) || (!(D <= 1.32e-138) && (D <= 9.8e-104)))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((c0 / w) * ((d / D) / h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (D <= 4.5e-256) or not ((D <= 2.85e-210) or (not (D <= 1.32e-138) and (D <= 9.8e-104))): tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((c0 / w) * ((d / D) / h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((D <= 4.5e-256) || !((D <= 2.85e-210) || (!(D <= 1.32e-138) && (D <= 9.8e-104)))) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(d / D) * Float64(Float64(c0 / w) * Float64(Float64(d / D) / h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((D <= 4.5e-256) || ~(((D <= 2.85e-210) || (~((D <= 1.32e-138)) && (D <= 9.8e-104))))) tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((c0 / w) * ((d / D) / h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[D, 4.5e-256], N[Not[Or[LessEqual[D, 2.85e-210], And[N[Not[LessEqual[D, 1.32e-138]], $MachinePrecision], LessEqual[D, 9.8e-104]]]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 4.5 \cdot 10^{-256} \lor \neg \left(D \leq 2.85 \cdot 10^{-210} \lor \neg \left(D \leq 1.32 \cdot 10^{-138}\right) \land D \leq 9.8 \cdot 10^{-104}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d}{D} \cdot \left(\frac{c0}{w} \cdot \frac{\frac{d}{D}}{h}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if D < 4.5000000000000003e-256 or 2.84999999999999985e-210 < D < 1.32e-138 or 9.8000000000000006e-104 < D Initial program 26.8%
times-frac24.5%
Simplified28.5%
Taylor expanded in c0 around inf 34.6%
associate-*r*34.7%
*-commutative34.7%
*-commutative34.7%
associate-/r*36.0%
associate-*l/37.3%
times-frac37.3%
unpow237.3%
associate-*r/41.1%
unpow241.1%
associate-/l/46.6%
associate-*r/44.9%
associate-*l/46.2%
unpow246.2%
Simplified46.2%
associate-*l/47.1%
Applied egg-rr47.1%
associate-*l/46.2%
pow246.2%
associate-*r*50.3%
associate-/r*48.4%
Applied egg-rr48.4%
Taylor expanded in c0 around 0 46.7%
associate-/r*47.9%
associate-*r/48.3%
*-commutative48.3%
times-frac50.9%
Simplified50.9%
if 4.5000000000000003e-256 < D < 2.84999999999999985e-210 or 1.32e-138 < D < 9.8000000000000006e-104Initial program 8.6%
times-frac8.3%
Simplified8.3%
Taylor expanded in c0 around -inf 8.2%
associate-*r*8.2%
neg-mul-18.2%
distribute-lft1-in8.2%
metadata-eval8.2%
mul0-lft53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-in53.5%
metadata-eval53.5%
mul0-lft8.2%
metadata-eval8.2%
distribute-lft1-in8.2%
distribute-lft-in8.0%
associate-*r*0.1%
*-commutative0.1%
*-commutative0.1%
associate-*r/0.1%
Simplified53.5%
Taylor expanded in c0 around 0 61.5%
Final simplification52.0%
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
def code(c0, w, h, D, d, M): return 0.0
function code(c0, w, h, D, d, M) return 0.0 end
function tmp = code(c0, w, h, D, d, M) tmp = 0.0; end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 25.0%
times-frac22.9%
Simplified26.6%
Taylor expanded in c0 around -inf 6.3%
associate-*r*6.3%
neg-mul-16.3%
distribute-lft1-in6.3%
metadata-eval6.3%
mul0-lft29.9%
distribute-lft-neg-in29.9%
distribute-rgt-neg-in29.9%
metadata-eval29.9%
mul0-lft6.3%
metadata-eval6.3%
distribute-lft1-in6.3%
distribute-lft-in5.9%
associate-*r*3.6%
*-commutative3.6%
*-commutative3.6%
associate-*r/3.7%
Simplified29.9%
Taylor expanded in c0 around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023309
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))