
(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 (* (* D D) (* w h)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) t_0)))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(* t_1 (* 2.0 (* d (* d (/ c0 t_0)))))
(fma 0.25 (/ (* (* D D) (* h (* M M))) (* d d)) 0.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (D * D) * (w * h);
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / t_0;
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_1 * (2.0 * (d * (d * (c0 / t_0))));
} else {
tmp = fma(0.25, (((D * D) * (h * (M * M))) / (d * d)), 0.0);
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(D * D) * Float64(w * h)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / t_0) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(t_1 * Float64(2.0 * Float64(d * Float64(d * Float64(c0 / t_0))))); else tmp = fma(0.25, Float64(Float64(Float64(D * D) * Float64(h * Float64(M * M))) / Float64(d * d)), 0.0); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 * N[(2.0 * N[(d * N[(d * N[(c0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(D \cdot D\right) \cdot \left(w \cdot h\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{t_0}\\
\mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(d \cdot \left(d \cdot \frac{c0}{t_0}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.25, \frac{\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot d}, 0\right)\\
\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 71.8%
Simplified72.4%
add-cbrt-cube71.4%
Applied egg-rr70.4%
associate-*l*70.4%
cube-unmult70.4%
Simplified70.4%
Taylor expanded in c0 around inf 70.8%
associate-*r*67.5%
*-commutative67.5%
unpow267.5%
*-commutative67.5%
associate-/l*68.5%
associate-/r/68.5%
unpow268.5%
*-commutative68.5%
unpow268.5%
unpow268.5%
Simplified68.5%
rem-cbrt-cube70.7%
*-commutative70.7%
*-commutative70.7%
associate-*l*72.8%
Applied egg-rr72.8%
Taylor expanded in d around 0 72.1%
*-commutative72.1%
associate-*r*69.7%
*-commutative69.7%
unpow269.7%
associate-*r*71.7%
associate-*r/72.8%
unpow272.8%
associate-*l*74.9%
associate-*r*72.8%
unpow272.8%
*-commutative72.8%
associate-*r*75.1%
unpow275.1%
Simplified75.1%
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%
Simplified1.9%
distribute-lft-in1.9%
Applied egg-rr16.1%
Taylor expanded in c0 around -inf 1.9%
fma-def1.9%
unpow21.9%
*-commutative1.9%
unpow21.9%
unpow21.9%
unpow21.9%
distribute-rgt-out1.9%
metadata-eval1.9%
mul0-rgt20.7%
Simplified20.7%
Taylor expanded in c0 around 0 35.8%
Final simplification50.2%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -5.1e+48)
0.0
(if (or (<= w 9.5e-164) (and (not (<= w 3.4e-138)) (<= w 5.2e+97)))
(* (* (/ c0 D) (/ c0 D)) (* (/ d h) (/ d (* w w))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -5.1e+48) {
tmp = 0.0;
} else if ((w <= 9.5e-164) || (!(w <= 3.4e-138) && (w <= 5.2e+97))) {
tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)));
} 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 (w <= (-5.1d+48)) then
tmp = 0.0d0
else if ((w <= 9.5d-164) .or. (.not. (w <= 3.4d-138)) .and. (w <= 5.2d+97)) then
tmp = ((c0 / d) * (c0 / d)) * ((d_1 / h) * (d_1 / (w * w)))
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 (w <= -5.1e+48) {
tmp = 0.0;
} else if ((w <= 9.5e-164) || (!(w <= 3.4e-138) && (w <= 5.2e+97))) {
tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -5.1e+48: tmp = 0.0 elif (w <= 9.5e-164) or (not (w <= 3.4e-138) and (w <= 5.2e+97)): tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -5.1e+48) tmp = 0.0; elseif ((w <= 9.5e-164) || (!(w <= 3.4e-138) && (w <= 5.2e+97))) tmp = Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(Float64(d / h) * Float64(d / Float64(w * w)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -5.1e+48) tmp = 0.0; elseif ((w <= 9.5e-164) || (~((w <= 3.4e-138)) && (w <= 5.2e+97))) tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -5.1e+48], 0.0, If[Or[LessEqual[w, 9.5e-164], And[N[Not[LessEqual[w, 3.4e-138]], $MachinePrecision], LessEqual[w, 5.2e+97]]], N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(d / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -5.1 \cdot 10^{+48}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 9.5 \cdot 10^{-164} \lor \neg \left(w \leq 3.4 \cdot 10^{-138}\right) \land w \leq 5.2 \cdot 10^{+97}:\\
\;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{h} \cdot \frac{d}{w \cdot w}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -5.0999999999999998e48 or 9.5000000000000001e-164 < w < 3.4000000000000001e-138 or 5.2e97 < w Initial program 19.3%
Simplified20.6%
Taylor expanded in c0 around -inf 6.6%
mul-1-neg6.6%
distribute-lft-in6.4%
Simplified34.7%
Taylor expanded in c0 around 0 36.0%
if -5.0999999999999998e48 < w < 9.5000000000000001e-164 or 3.4000000000000001e-138 < w < 5.2e97Initial program 29.7%
Simplified31.3%
Taylor expanded in c0 around inf 32.4%
times-frac33.4%
unpow233.4%
unpow233.4%
unpow233.4%
unpow233.4%
Simplified33.4%
times-frac42.9%
Applied egg-rr42.9%
times-frac50.2%
Applied egg-rr50.2%
Final simplification45.7%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= (* M M) 1.32e-122)
(* (/ c0 (* 2.0 w)) (* 2.0 (* d (* d (/ c0 (* (* D D) (* w h)))))))
(if (<= (* M M) 5.4e-35)
0.0
(* (/ c0 D) (* (/ c0 D) (/ (* d (/ (/ d w) w)) h))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 1.32e-122) {
tmp = (c0 / (2.0 * w)) * (2.0 * (d * (d * (c0 / ((D * D) * (w * h))))));
} else if ((M * M) <= 5.4e-35) {
tmp = 0.0;
} else {
tmp = (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h));
}
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 ((m * m) <= 1.32d-122) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (d_1 * (d_1 * (c0 / ((d * d) * (w * h))))))
else if ((m * m) <= 5.4d-35) then
tmp = 0.0d0
else
tmp = (c0 / d) * ((c0 / d) * ((d_1 * ((d_1 / w) / w)) / h))
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 ((M * M) <= 1.32e-122) {
tmp = (c0 / (2.0 * w)) * (2.0 * (d * (d * (c0 / ((D * D) * (w * h))))));
} else if ((M * M) <= 5.4e-35) {
tmp = 0.0;
} else {
tmp = (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 1.32e-122: tmp = (c0 / (2.0 * w)) * (2.0 * (d * (d * (c0 / ((D * D) * (w * h)))))) elif (M * M) <= 5.4e-35: tmp = 0.0 else: tmp = (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 1.32e-122) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(d * Float64(d * Float64(c0 / Float64(Float64(D * D) * Float64(w * h))))))); elseif (Float64(M * M) <= 5.4e-35) tmp = 0.0; else tmp = Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(d * Float64(Float64(d / w) / w)) / h))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 1.32e-122) tmp = (c0 / (2.0 * w)) * (2.0 * (d * (d * (c0 / ((D * D) * (w * h)))))); elseif ((M * M) <= 5.4e-35) tmp = 0.0; else tmp = (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 1.32e-122], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(d * N[(d * N[(c0 / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(M * M), $MachinePrecision], 5.4e-35], 0.0, N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(d * N[(N[(d / w), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 1.32 \cdot 10^{-122}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \left(d \cdot \frac{c0}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\right)\right)\right)\\
\mathbf{elif}\;M \cdot M \leq 5.4 \cdot 10^{-35}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot \frac{\frac{d}{w}}{w}}{h}\right)\\
\end{array}
\end{array}
if (*.f64 M M) < 1.3200000000000001e-122Initial program 34.3%
Simplified34.3%
add-cbrt-cube33.4%
Applied egg-rr37.1%
associate-*l*37.1%
cube-unmult37.1%
Simplified40.4%
Taylor expanded in c0 around inf 33.7%
associate-*r*32.9%
*-commutative32.9%
unpow232.9%
*-commutative32.9%
associate-/l*35.5%
associate-/r/35.5%
unpow235.5%
*-commutative35.5%
unpow235.5%
unpow235.5%
Simplified35.5%
rem-cbrt-cube37.2%
*-commutative37.2%
*-commutative37.2%
associate-*l*39.8%
Applied egg-rr39.8%
Taylor expanded in d around 0 34.8%
*-commutative34.8%
associate-*r*34.6%
*-commutative34.6%
unpow234.6%
associate-*r*38.1%
associate-*r/39.8%
unpow239.8%
associate-*l*48.1%
associate-*r*44.7%
unpow244.7%
*-commutative44.7%
associate-*r*44.7%
unpow244.7%
Simplified44.7%
if 1.3200000000000001e-122 < (*.f64 M M) < 5.3999999999999995e-35Initial program 17.6%
Simplified17.6%
Taylor expanded in c0 around -inf 0.3%
mul-1-neg0.3%
distribute-lft-in0.3%
Simplified43.2%
Taylor expanded in c0 around 0 49.3%
if 5.3999999999999995e-35 < (*.f64 M M) Initial program 20.3%
Simplified21.9%
Taylor expanded in c0 around inf 25.6%
times-frac25.6%
unpow225.6%
unpow225.6%
unpow225.6%
unpow225.6%
Simplified25.6%
pow125.6%
times-frac34.6%
times-frac40.4%
Applied egg-rr40.4%
unpow140.4%
associate-*l*43.8%
associate-*l/44.7%
associate-/r*47.0%
Simplified47.0%
Final simplification46.1%
(FPCore (c0 w h D d M) :precision binary64 (if (<= D 3.7e+56) (* (/ c0 D) (* (/ c0 D) (/ (/ (* d (/ d w)) w) h))) (/ c0 (/ D (/ (* d (/ c0 D)) (* (/ h d) (* w w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 3.7e+56) {
tmp = (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h));
} else {
tmp = c0 / (D / ((d * (c0 / D)) / ((h / d) * (w * w))));
}
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 <= 3.7d+56) then
tmp = (c0 / d) * ((c0 / d) * (((d_1 * (d_1 / w)) / w) / h))
else
tmp = c0 / (d / ((d_1 * (c0 / d)) / ((h / d_1) * (w * w))))
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 <= 3.7e+56) {
tmp = (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h));
} else {
tmp = c0 / (D / ((d * (c0 / D)) / ((h / d) * (w * w))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 3.7e+56: tmp = (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h)) else: tmp = c0 / (D / ((d * (c0 / D)) / ((h / d) * (w * w)))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 3.7e+56) tmp = Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(Float64(d * Float64(d / w)) / w) / h))); else tmp = Float64(c0 / Float64(D / Float64(Float64(d * Float64(c0 / D)) / Float64(Float64(h / d) * Float64(w * w))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 3.7e+56) tmp = (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h)); else tmp = c0 / (D / ((d * (c0 / D)) / ((h / d) * (w * w)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 3.7e+56], N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(N[(d * N[(d / w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(D / N[(N[(d * N[(c0 / D), $MachinePrecision]), $MachinePrecision] / N[(N[(h / d), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 3.7 \cdot 10^{+56}:\\
\;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{\frac{d \cdot \frac{d}{w}}{w}}{h}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{D}{\frac{d \cdot \frac{c0}{D}}{\frac{h}{d} \cdot \left(w \cdot w\right)}}}\\
\end{array}
\end{array}
if D < 3.69999999999999997e56Initial program 27.0%
Simplified28.7%
Taylor expanded in c0 around inf 23.3%
times-frac24.4%
unpow224.4%
unpow224.4%
unpow224.4%
unpow224.4%
Simplified24.4%
pow124.4%
times-frac31.0%
times-frac36.9%
Applied egg-rr36.9%
unpow136.9%
associate-*l*39.5%
associate-*l/39.4%
associate-/r*41.4%
Simplified41.4%
associate-*r/43.0%
Applied egg-rr43.0%
if 3.69999999999999997e56 < D Initial program 19.0%
Simplified19.0%
Taylor expanded in c0 around inf 33.6%
times-frac29.4%
unpow229.4%
unpow229.4%
unpow229.4%
unpow229.4%
Simplified29.4%
pow129.4%
times-frac39.2%
times-frac43.7%
Applied egg-rr43.7%
unpow143.7%
associate-*l*49.2%
associate-*l/44.7%
associate-/r*44.7%
Simplified44.7%
associate-*l/44.7%
associate-/l*44.8%
associate-/l/44.8%
Applied egg-rr44.8%
associate-/l*49.3%
associate-*r/54.0%
unpow254.0%
associate-/r/49.2%
unpow249.2%
Simplified49.2%
Final simplification43.5%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 D) (* (/ c0 D) (/ (* d (/ (/ d w) w)) h))))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h));
}
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 = (c0 / d) * ((c0 / d) * ((d_1 * ((d_1 / w) / w)) / h))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h));
}
def code(c0, w, h, D, d, M): return (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h))
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(d * Float64(Float64(d / w) / w)) / h))) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / D) * ((c0 / D) * ((d * ((d / w) / w)) / h)); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(d * N[(N[(d / w), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot \frac{\frac{d}{w}}{w}}{h}\right)
\end{array}
Initial program 26.4%
Simplified27.9%
Taylor expanded in c0 around inf 24.2%
times-frac24.8%
unpow224.8%
unpow224.8%
unpow224.8%
unpow224.8%
Simplified24.8%
pow124.8%
times-frac31.7%
times-frac37.5%
Applied egg-rr37.5%
unpow137.5%
associate-*l*40.3%
associate-*l/39.8%
associate-/r*41.7%
Simplified41.7%
Final simplification41.7%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 D) (* (/ c0 D) (/ (/ (* d (/ d w)) w) h))))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h));
}
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 = (c0 / d) * ((c0 / d) * (((d_1 * (d_1 / w)) / w) / h))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h));
}
def code(c0, w, h, D, d, M): return (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h))
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(Float64(d * Float64(d / w)) / w) / h))) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / D) * ((c0 / D) * (((d * (d / w)) / w) / h)); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(N[(d * N[(d / w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{\frac{d \cdot \frac{d}{w}}{w}}{h}\right)
\end{array}
Initial program 26.4%
Simplified27.9%
Taylor expanded in c0 around inf 24.2%
times-frac24.8%
unpow224.8%
unpow224.8%
unpow224.8%
unpow224.8%
Simplified24.8%
pow124.8%
times-frac31.7%
times-frac37.5%
Applied egg-rr37.5%
unpow137.5%
associate-*l*40.3%
associate-*l/39.8%
associate-/r*41.7%
Simplified41.7%
associate-*r/43.2%
Applied egg-rr43.2%
Final simplification43.2%
(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 26.4%
Simplified27.9%
Taylor expanded in c0 around -inf 3.0%
mul-1-neg3.0%
distribute-lft-in3.0%
Simplified21.0%
Taylor expanded in c0 around 0 24.0%
Final simplification24.0%
herbie shell --seed 2023287
(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))))))