
(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 8 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 (if (<= h -9.4e-308) (* (* c0 2.0) (* (* (pow (/ d D) 2.0) (/ (/ c0 w) h)) (/ 0.5 w))) (pow (* d (/ c0 (* (* D w) (sqrt h)))) 2.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -9.4e-308) {
tmp = (c0 * 2.0) * ((pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w));
} else {
tmp = pow((d * (c0 / ((D * w) * sqrt(h)))), 2.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 (h <= (-9.4d-308)) then
tmp = (c0 * 2.0d0) * ((((d_1 / d) ** 2.0d0) * ((c0 / w) / h)) * (0.5d0 / w))
else
tmp = (d_1 * (c0 / ((d * w) * sqrt(h)))) ** 2.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 (h <= -9.4e-308) {
tmp = (c0 * 2.0) * ((Math.pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w));
} else {
tmp = Math.pow((d * (c0 / ((D * w) * Math.sqrt(h)))), 2.0);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -9.4e-308: tmp = (c0 * 2.0) * ((math.pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w)) else: tmp = math.pow((d * (c0 / ((D * w) * math.sqrt(h)))), 2.0) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -9.4e-308) tmp = Float64(Float64(c0 * 2.0) * Float64(Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / w) / h)) * Float64(0.5 / w))); else tmp = Float64(d * Float64(c0 / Float64(Float64(D * w) * sqrt(h)))) ^ 2.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -9.4e-308) tmp = (c0 * 2.0) * ((((d / D) ^ 2.0) * ((c0 / w) / h)) * (0.5 / w)); else tmp = (d * (c0 / ((D * w) * sqrt(h)))) ^ 2.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -9.4e-308], N[(N[(c0 * 2.0), $MachinePrecision] * N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] * N[(0.5 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(d * N[(c0 / N[(N[(D * w), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -9.4 \cdot 10^{-308}:\\
\;\;\;\;\left(c0 \cdot 2\right) \cdot \left(\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{0.5}{w}\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\left(D \cdot w\right) \cdot \sqrt{h}}\right)}^{2}\\
\end{array}
\end{array}
if h < -9.4000000000000009e-308Initial program 22.4%
Simplified37.9%
Taylor expanded in w around 0 4.6%
Simplified30.7%
Taylor expanded in D around 0 33.1%
associate-/l*33.2%
associate-/r*33.3%
unpow233.3%
unpow233.3%
times-frac45.0%
unpow245.0%
Simplified45.0%
associate-*r/43.0%
associate-*r/42.9%
*-commutative42.9%
associate-*l/43.6%
*-commutative43.6%
associate-/r*44.6%
Applied egg-rr44.6%
div-inv44.6%
associate-*r*44.6%
associate-/l/43.6%
*-commutative43.6%
Applied egg-rr43.6%
associate-*l*44.4%
associate-/r*44.4%
metadata-eval44.4%
associate-/r*46.2%
Simplified46.2%
if -9.4000000000000009e-308 < h Initial program 30.2%
Simplified44.0%
Taylor expanded in c0 around inf 29.7%
div-inv29.8%
pow-prod-down41.1%
Applied egg-rr41.1%
unpow241.1%
*-commutative41.1%
*-commutative41.1%
Applied egg-rr41.1%
un-div-inv41.1%
pow241.1%
add-sqr-sqrt41.1%
pow241.1%
sqrt-prod41.1%
sqrt-pow146.7%
metadata-eval46.7%
pow146.7%
*-commutative46.7%
sqrt-prod47.6%
sqrt-pow152.5%
metadata-eval52.5%
pow152.5%
Applied egg-rr52.5%
unpow252.5%
unpow252.5%
times-frac61.0%
unpow261.0%
associate-/l*60.0%
associate-*r*61.1%
Simplified61.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* D D) (* h w))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 (* c0 (/ 0.0 (* 2.0 w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (h * w));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (h * w));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((D * D) * (h * w)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(h * w))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((D * D) * (h * w)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 79.1%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified23.9%
Taylor expanded in c0 around -inf 1.0%
mul-1-neg1.0%
distribute-lft-in0.3%
mul-1-neg0.3%
distribute-rgt-neg-in0.3%
associate-/l*2.0%
mul-1-neg2.0%
associate-/l*0.8%
distribute-lft1-in0.8%
metadata-eval0.8%
mul0-lft40.2%
metadata-eval40.2%
Simplified40.2%
Final simplification53.2%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -4.4e-154) (not (<= c0 5.5e+49))) (* (* c0 2.0) (* (* (pow (/ d D) 2.0) (/ (/ c0 w) h)) (/ 0.5 w))) (* c0 (/ 0.0 (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -4.4e-154) || !(c0 <= 5.5e+49)) {
tmp = (c0 * 2.0) * ((pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w));
} else {
tmp = c0 * (0.0 / (2.0 * 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 ((c0 <= (-4.4d-154)) .or. (.not. (c0 <= 5.5d+49))) then
tmp = (c0 * 2.0d0) * ((((d_1 / d) ** 2.0d0) * ((c0 / w) / h)) * (0.5d0 / w))
else
tmp = c0 * (0.0d0 / (2.0d0 * 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 ((c0 <= -4.4e-154) || !(c0 <= 5.5e+49)) {
tmp = (c0 * 2.0) * ((Math.pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -4.4e-154) or not (c0 <= 5.5e+49): tmp = (c0 * 2.0) * ((math.pow((d / D), 2.0) * ((c0 / w) / h)) * (0.5 / w)) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -4.4e-154) || !(c0 <= 5.5e+49)) tmp = Float64(Float64(c0 * 2.0) * Float64(Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / w) / h)) * Float64(0.5 / w))); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -4.4e-154) || ~((c0 <= 5.5e+49))) tmp = (c0 * 2.0) * ((((d / D) ^ 2.0) * ((c0 / w) / h)) * (0.5 / w)); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -4.4e-154], N[Not[LessEqual[c0, 5.5e+49]], $MachinePrecision]], N[(N[(c0 * 2.0), $MachinePrecision] * N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] * N[(0.5 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -4.4 \cdot 10^{-154} \lor \neg \left(c0 \leq 5.5 \cdot 10^{+49}\right):\\
\;\;\;\;\left(c0 \cdot 2\right) \cdot \left(\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{0.5}{w}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -4.40000000000000015e-154 or 5.50000000000000042e49 < c0 Initial program 30.9%
Simplified45.2%
Taylor expanded in w around 0 7.4%
Simplified38.3%
Taylor expanded in D around 0 42.3%
associate-/l*41.8%
associate-/r*41.9%
unpow241.9%
unpow241.9%
times-frac55.3%
unpow255.3%
Simplified55.3%
associate-*r/54.2%
associate-*r/53.9%
*-commutative53.9%
associate-*l/54.2%
*-commutative54.2%
associate-/r*54.9%
Applied egg-rr54.9%
div-inv54.9%
associate-*r*54.9%
associate-/l/54.2%
*-commutative54.2%
Applied egg-rr54.2%
associate-*l*55.3%
associate-/r*55.3%
metadata-eval55.3%
associate-/r*56.6%
Simplified56.6%
if -4.40000000000000015e-154 < c0 < 5.50000000000000042e49Initial program 18.5%
Simplified33.6%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
distribute-lft-in2.8%
mul-1-neg2.8%
distribute-rgt-neg-in2.8%
associate-/l*1.8%
mul-1-neg1.8%
associate-/l*6.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft48.2%
metadata-eval48.2%
Simplified48.2%
Final simplification53.7%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -2e-159) (not (<= c0 2.9e+49))) (* c0 (/ (* (pow (/ d D) 2.0) (/ (/ c0 w) h)) w)) (* c0 (/ 0.0 (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -2e-159) || !(c0 <= 2.9e+49)) {
tmp = c0 * ((pow((d / D), 2.0) * ((c0 / w) / h)) / w);
} else {
tmp = c0 * (0.0 / (2.0 * 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 ((c0 <= (-2d-159)) .or. (.not. (c0 <= 2.9d+49))) then
tmp = c0 * ((((d_1 / d) ** 2.0d0) * ((c0 / w) / h)) / w)
else
tmp = c0 * (0.0d0 / (2.0d0 * 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 ((c0 <= -2e-159) || !(c0 <= 2.9e+49)) {
tmp = c0 * ((Math.pow((d / D), 2.0) * ((c0 / w) / h)) / w);
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -2e-159) or not (c0 <= 2.9e+49): tmp = c0 * ((math.pow((d / D), 2.0) * ((c0 / w) / h)) / w) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -2e-159) || !(c0 <= 2.9e+49)) tmp = Float64(c0 * Float64(Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / w) / h)) / w)); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -2e-159) || ~((c0 <= 2.9e+49))) tmp = c0 * ((((d / D) ^ 2.0) * ((c0 / w) / h)) / w); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -2e-159], N[Not[LessEqual[c0, 2.9e+49]], $MachinePrecision]], N[(c0 * N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -2 \cdot 10^{-159} \lor \neg \left(c0 \leq 2.9 \cdot 10^{+49}\right):\\
\;\;\;\;c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{w}}{h}}{w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -1.99999999999999998e-159 or 2.9e49 < c0 Initial program 30.9%
Simplified45.2%
Taylor expanded in w around 0 7.4%
Simplified38.3%
Taylor expanded in D around 0 42.3%
associate-/l*41.8%
associate-/r*41.9%
unpow241.9%
unpow241.9%
times-frac55.3%
unpow255.3%
Simplified55.3%
times-frac55.3%
metadata-eval55.3%
associate-*r/53.8%
*-commutative53.8%
associate-*l/55.3%
*-commutative55.3%
associate-/r*56.6%
Applied egg-rr56.6%
if -1.99999999999999998e-159 < c0 < 2.9e49Initial program 18.5%
Simplified33.6%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
distribute-lft-in2.8%
mul-1-neg2.8%
distribute-rgt-neg-in2.8%
associate-/l*1.8%
mul-1-neg1.8%
associate-/l*6.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft48.2%
metadata-eval48.2%
Simplified48.2%
Final simplification53.7%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -8e-158) (not (<= c0 3.4e+49))) (* c0 (/ (* (pow (/ d D) 2.0) (/ c0 (* h w))) w)) (* c0 (/ 0.0 (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -8e-158) || !(c0 <= 3.4e+49)) {
tmp = c0 * ((pow((d / D), 2.0) * (c0 / (h * w))) / w);
} else {
tmp = c0 * (0.0 / (2.0 * 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 ((c0 <= (-8d-158)) .or. (.not. (c0 <= 3.4d+49))) then
tmp = c0 * ((((d_1 / d) ** 2.0d0) * (c0 / (h * w))) / w)
else
tmp = c0 * (0.0d0 / (2.0d0 * 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 ((c0 <= -8e-158) || !(c0 <= 3.4e+49)) {
tmp = c0 * ((Math.pow((d / D), 2.0) * (c0 / (h * w))) / w);
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -8e-158) or not (c0 <= 3.4e+49): tmp = c0 * ((math.pow((d / D), 2.0) * (c0 / (h * w))) / w) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -8e-158) || !(c0 <= 3.4e+49)) tmp = Float64(c0 * Float64(Float64((Float64(d / D) ^ 2.0) * Float64(c0 / Float64(h * w))) / w)); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -8e-158) || ~((c0 <= 3.4e+49))) tmp = c0 * ((((d / D) ^ 2.0) * (c0 / (h * w))) / w); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -8e-158], N[Not[LessEqual[c0, 3.4e+49]], $MachinePrecision]], N[(c0 * N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(c0 / N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -8 \cdot 10^{-158} \lor \neg \left(c0 \leq 3.4 \cdot 10^{+49}\right):\\
\;\;\;\;c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h \cdot w}}{w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -8.00000000000000052e-158 or 3.4000000000000001e49 < c0 Initial program 30.9%
Simplified45.2%
Taylor expanded in w around 0 7.4%
Simplified38.3%
Taylor expanded in D around 0 42.3%
associate-/l*41.8%
associate-/r*41.9%
unpow241.9%
unpow241.9%
times-frac55.3%
unpow255.3%
Simplified55.3%
pow155.3%
times-frac55.3%
metadata-eval55.3%
associate-*r/53.8%
*-commutative53.8%
associate-*l/55.3%
*-commutative55.3%
associate-/r*56.6%
Applied egg-rr56.6%
unpow156.6%
*-lft-identity56.6%
associate-/l*55.0%
associate-/l/54.3%
Simplified54.3%
associate-*r/55.3%
associate-/l/56.6%
associate-/l/55.3%
*-commutative55.3%
Applied egg-rr55.3%
if -8.00000000000000052e-158 < c0 < 3.4000000000000001e49Initial program 18.5%
Simplified33.6%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
distribute-lft-in2.8%
mul-1-neg2.8%
distribute-rgt-neg-in2.8%
associate-/l*1.8%
mul-1-neg1.8%
associate-/l*6.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft48.2%
metadata-eval48.2%
Simplified48.2%
Final simplification52.9%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -7.2e-155) (not (<= c0 2.9e-21))) (* c0 (* (pow (/ d D) 2.0) (/ (/ c0 (* h w)) w))) (* c0 (/ 0.0 (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -7.2e-155) || !(c0 <= 2.9e-21)) {
tmp = c0 * (pow((d / D), 2.0) * ((c0 / (h * w)) / w));
} else {
tmp = c0 * (0.0 / (2.0 * 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 ((c0 <= (-7.2d-155)) .or. (.not. (c0 <= 2.9d-21))) then
tmp = c0 * (((d_1 / d) ** 2.0d0) * ((c0 / (h * w)) / w))
else
tmp = c0 * (0.0d0 / (2.0d0 * 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 ((c0 <= -7.2e-155) || !(c0 <= 2.9e-21)) {
tmp = c0 * (Math.pow((d / D), 2.0) * ((c0 / (h * w)) / w));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -7.2e-155) or not (c0 <= 2.9e-21): tmp = c0 * (math.pow((d / D), 2.0) * ((c0 / (h * w)) / w)) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -7.2e-155) || !(c0 <= 2.9e-21)) tmp = Float64(c0 * Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / Float64(h * w)) / w))); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -7.2e-155) || ~((c0 <= 2.9e-21))) tmp = c0 * (((d / D) ^ 2.0) * ((c0 / (h * w)) / w)); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -7.2e-155], N[Not[LessEqual[c0, 2.9e-21]], $MachinePrecision]], N[(c0 * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / N[(h * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -7.2 \cdot 10^{-155} \lor \neg \left(c0 \leq 2.9 \cdot 10^{-21}\right):\\
\;\;\;\;c0 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{h \cdot w}}{w}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -7.19999999999999977e-155 or 2.9e-21 < c0 Initial program 29.1%
Simplified44.1%
Taylor expanded in w around 0 7.1%
Simplified37.0%
Taylor expanded in D around 0 40.6%
associate-/l*40.1%
associate-/r*39.7%
unpow239.7%
unpow239.7%
times-frac53.8%
unpow253.8%
Simplified53.8%
pow153.8%
times-frac53.8%
metadata-eval53.8%
associate-*r/52.5%
*-commutative52.5%
associate-*l/53.8%
*-commutative53.8%
associate-/r*54.9%
Applied egg-rr54.9%
unpow154.9%
*-lft-identity54.9%
associate-/l*54.0%
associate-/l/53.4%
Simplified53.4%
if -7.19999999999999977e-155 < c0 < 2.9e-21Initial program 19.6%
Simplified33.1%
Taylor expanded in c0 around -inf 3.5%
mul-1-neg3.5%
distribute-lft-in3.5%
mul-1-neg3.5%
distribute-rgt-neg-in3.5%
associate-/l*2.1%
mul-1-neg2.1%
associate-/l*7.8%
distribute-lft1-in7.8%
metadata-eval7.8%
mul0-lft49.6%
metadata-eval49.6%
Simplified49.6%
Final simplification52.4%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -2e-158) (not (<= c0 2.4e-21))) (* c0 (* (pow (/ d D) 2.0) (/ c0 (* w (* h w))))) (* c0 (/ 0.0 (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -2e-158) || !(c0 <= 2.4e-21)) {
tmp = c0 * (pow((d / D), 2.0) * (c0 / (w * (h * w))));
} else {
tmp = c0 * (0.0 / (2.0 * 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 ((c0 <= (-2d-158)) .or. (.not. (c0 <= 2.4d-21))) then
tmp = c0 * (((d_1 / d) ** 2.0d0) * (c0 / (w * (h * w))))
else
tmp = c0 * (0.0d0 / (2.0d0 * 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 ((c0 <= -2e-158) || !(c0 <= 2.4e-21)) {
tmp = c0 * (Math.pow((d / D), 2.0) * (c0 / (w * (h * w))));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -2e-158) or not (c0 <= 2.4e-21): tmp = c0 * (math.pow((d / D), 2.0) * (c0 / (w * (h * w)))) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -2e-158) || !(c0 <= 2.4e-21)) tmp = Float64(c0 * Float64((Float64(d / D) ^ 2.0) * Float64(c0 / Float64(w * Float64(h * w))))); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -2e-158) || ~((c0 <= 2.4e-21))) tmp = c0 * (((d / D) ^ 2.0) * (c0 / (w * (h * w)))); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -2e-158], N[Not[LessEqual[c0, 2.4e-21]], $MachinePrecision]], N[(c0 * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(c0 / N[(w * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -2 \cdot 10^{-158} \lor \neg \left(c0 \leq 2.4 \cdot 10^{-21}\right):\\
\;\;\;\;c0 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot \left(h \cdot w\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -2.00000000000000013e-158 or 2.3999999999999999e-21 < c0 Initial program 29.1%
Simplified44.1%
Taylor expanded in w around 0 7.1%
Simplified37.0%
Taylor expanded in D around 0 40.6%
associate-/l*40.1%
associate-/r*39.7%
unpow239.7%
unpow239.7%
times-frac53.8%
unpow253.8%
Simplified53.8%
associate-*r/52.8%
associate-*r/52.5%
*-commutative52.5%
associate-*l/52.8%
*-commutative52.8%
associate-/r*53.4%
Applied egg-rr53.4%
associate-/l*54.9%
times-frac54.9%
metadata-eval54.9%
associate-/l/53.8%
associate-*r/53.4%
*-un-lft-identity53.4%
*-commutative53.4%
Applied egg-rr53.4%
associate-/l/50.2%
*-commutative50.2%
Simplified50.2%
if -2.00000000000000013e-158 < c0 < 2.3999999999999999e-21Initial program 19.6%
Simplified33.1%
Taylor expanded in c0 around -inf 3.5%
mul-1-neg3.5%
distribute-lft-in3.5%
mul-1-neg3.5%
distribute-rgt-neg-in3.5%
associate-/l*2.1%
mul-1-neg2.1%
associate-/l*7.8%
distribute-lft1-in7.8%
metadata-eval7.8%
mul0-lft49.6%
metadata-eval49.6%
Simplified49.6%
Final simplification50.1%
(FPCore (c0 w h D d M) :precision binary64 (* c0 (/ 0.0 (* 2.0 w))))
double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (0.0 / (2.0 * w));
}
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 * (0.0d0 / (2.0d0 * w))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (0.0 / (2.0 * w));
}
def code(c0, w, h, D, d, M): return c0 * (0.0 / (2.0 * w))
function code(c0, w, h, D, d, M) return Float64(c0 * Float64(0.0 / Float64(2.0 * w))) end
function tmp = code(c0, w, h, D, d, M) tmp = c0 * (0.0 / (2.0 * w)); end
code[c0_, w_, h_, D_, d_, M_] := N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \frac{0}{2 \cdot w}
\end{array}
Initial program 26.6%
Simplified41.2%
Taylor expanded in c0 around -inf 2.5%
mul-1-neg2.5%
distribute-lft-in2.1%
mul-1-neg2.1%
distribute-rgt-neg-in2.1%
associate-/l*3.7%
mul-1-neg3.7%
associate-/l*3.2%
distribute-lft1-in3.2%
metadata-eval3.2%
mul0-lft29.7%
metadata-eval29.7%
Simplified29.7%
herbie shell --seed 2024111
(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))))))