
(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 INFINITY) t_2 (* t_0 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 t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_0 * 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 t_2 = t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = t_0 * 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)) t_2 = t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = t_0 * 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))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = Float64(t_0 * 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)); t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = t_0 * 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]}, 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, Infinity], t$95$2, N[(t$95$0 * 0.0), $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 \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 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 80.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%
Simplified2.8%
Taylor expanded in c0 around -inf 1.2%
associate-*r*1.2%
neg-mul-11.2%
distribute-lft1-in1.2%
metadata-eval1.2%
mul0-lft42.4%
distribute-lft-neg-in42.4%
distribute-rgt-neg-in42.4%
metadata-eval42.4%
mul0-lft1.2%
metadata-eval1.2%
distribute-lft1-in1.2%
distribute-lft-in0.6%
Simplified42.4%
Final simplification53.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ (/ c0 w) h) (pow (/ d D) 2.0)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (* t_1 (* 2.0 t_0)))
(t_3 (* t_1 0.0)))
(if (<= c0 -2.5e-154)
t_2
(if (<= c0 9e-38)
t_3
(if (<= c0 5.6e+72)
(* t_1 (+ t_0 (* (/ c0 (* w h)) (* (/ d D) (/ d D)))))
(if (<= c0 4e+101) t_3 t_2))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = ((c0 / w) / h) * pow((d / D), 2.0);
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (2.0 * t_0);
double t_3 = t_1 * 0.0;
double tmp;
if (c0 <= -2.5e-154) {
tmp = t_2;
} else if (c0 <= 9e-38) {
tmp = t_3;
} else if (c0 <= 5.6e+72) {
tmp = t_1 * (t_0 + ((c0 / (w * h)) * ((d / D) * (d / D))));
} else if (c0 <= 4e+101) {
tmp = t_3;
} else {
tmp = t_2;
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = ((c0 / w) / h) * ((d_1 / d) ** 2.0d0)
t_1 = c0 / (2.0d0 * w)
t_2 = t_1 * (2.0d0 * t_0)
t_3 = t_1 * 0.0d0
if (c0 <= (-2.5d-154)) then
tmp = t_2
else if (c0 <= 9d-38) then
tmp = t_3
else if (c0 <= 5.6d+72) then
tmp = t_1 * (t_0 + ((c0 / (w * h)) * ((d_1 / d) * (d_1 / d))))
else if (c0 <= 4d+101) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = ((c0 / w) / h) * Math.pow((d / D), 2.0);
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (2.0 * t_0);
double t_3 = t_1 * 0.0;
double tmp;
if (c0 <= -2.5e-154) {
tmp = t_2;
} else if (c0 <= 9e-38) {
tmp = t_3;
} else if (c0 <= 5.6e+72) {
tmp = t_1 * (t_0 + ((c0 / (w * h)) * ((d / D) * (d / D))));
} else if (c0 <= 4e+101) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = ((c0 / w) / h) * math.pow((d / D), 2.0) t_1 = c0 / (2.0 * w) t_2 = t_1 * (2.0 * t_0) t_3 = t_1 * 0.0 tmp = 0 if c0 <= -2.5e-154: tmp = t_2 elif c0 <= 9e-38: tmp = t_3 elif c0 <= 5.6e+72: tmp = t_1 * (t_0 + ((c0 / (w * h)) * ((d / D) * (d / D)))) elif c0 <= 4e+101: tmp = t_3 else: tmp = t_2 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(Float64(c0 / w) / h) * (Float64(d / D) ^ 2.0)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_1 * Float64(2.0 * t_0)) t_3 = Float64(t_1 * 0.0) tmp = 0.0 if (c0 <= -2.5e-154) tmp = t_2; elseif (c0 <= 9e-38) tmp = t_3; elseif (c0 <= 5.6e+72) tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d / D) * Float64(d / D))))); elseif (c0 <= 4e+101) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = ((c0 / w) / h) * ((d / D) ^ 2.0); t_1 = c0 / (2.0 * w); t_2 = t_1 * (2.0 * t_0); t_3 = t_1 * 0.0; tmp = 0.0; if (c0 <= -2.5e-154) tmp = t_2; elseif (c0 <= 9e-38) tmp = t_3; elseif (c0 <= 5.6e+72) tmp = t_1 * (t_0 + ((c0 / (w * h)) * ((d / D) * (d / D)))); elseif (c0 <= 4e+101) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * 0.0), $MachinePrecision]}, If[LessEqual[c0, -2.5e-154], t$95$2, If[LessEqual[c0, 9e-38], t$95$3, If[LessEqual[c0, 5.6e+72], N[(t$95$1 * N[(t$95$0 + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 4e+101], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := t_1 \cdot \left(2 \cdot t_0\right)\\
t_3 := t_1 \cdot 0\\
\mathbf{if}\;c0 \leq -2.5 \cdot 10^{-154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq 9 \cdot 10^{-38}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 5.6 \cdot 10^{+72}:\\
\;\;\;\;t_1 \cdot \left(t_0 + \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;c0 \leq 4 \cdot 10^{+101}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if c0 < -2.5000000000000001e-154 or 3.9999999999999999e101 < c0 Initial program 27.6%
Simplified28.2%
Taylor expanded in c0 around inf 35.7%
*-commutative35.7%
*-commutative35.7%
associate-*r*35.8%
associate-/r*35.8%
associate-*l/36.6%
times-frac36.1%
unpow236.1%
associate-*r/41.2%
unpow241.2%
associate-/l/43.3%
associate-*r/43.9%
associate-*l/45.2%
unpow245.2%
Simplified45.2%
if -2.5000000000000001e-154 < c0 < 9.00000000000000018e-38 or 5.5999999999999998e72 < c0 < 3.9999999999999999e101Initial program 18.1%
Simplified20.4%
Taylor expanded in c0 around -inf 6.2%
associate-*r*6.2%
neg-mul-16.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft53.2%
distribute-lft-neg-in53.2%
distribute-rgt-neg-in53.2%
metadata-eval53.2%
mul0-lft6.2%
metadata-eval6.2%
distribute-lft1-in6.2%
distribute-lft-in6.2%
Simplified53.2%
if 9.00000000000000018e-38 < c0 < 5.5999999999999998e72Initial program 26.9%
Simplified27.0%
Taylor expanded in c0 around inf 42.7%
*-commutative42.7%
*-commutative42.7%
associate-*r*42.7%
associate-/r*43.0%
associate-*l/43.0%
times-frac43.0%
unpow243.0%
associate-*r/43.0%
unpow243.0%
associate-/l/43.0%
associate-*r/43.0%
associate-*l/43.0%
unpow243.0%
Simplified43.0%
frac-times52.2%
Applied egg-rr52.2%
Final simplification48.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* w h)))
(t_1 (* (/ (/ c0 w) h) (pow (/ d D) 2.0)))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (* t_2 0.0)))
(if (<= c0 -1.3e-154)
(* t_2 (+ (* t_0 (/ 1.0 (* (/ D d) (/ D d)))) t_1))
(if (<= c0 9.2e-38)
t_3
(if (<= c0 5.6e+72)
(* t_2 (+ t_1 (* t_0 (* (/ d D) (/ d D)))))
(if (<= c0 3.9e+101) t_3 (* t_2 (* 2.0 t_1))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = ((c0 / w) / h) * pow((d / D), 2.0);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * 0.0;
double tmp;
if (c0 <= -1.3e-154) {
tmp = t_2 * ((t_0 * (1.0 / ((D / d) * (D / d)))) + t_1);
} else if (c0 <= 9.2e-38) {
tmp = t_3;
} else if (c0 <= 5.6e+72) {
tmp = t_2 * (t_1 + (t_0 * ((d / D) * (d / D))));
} else if (c0 <= 3.9e+101) {
tmp = t_3;
} else {
tmp = t_2 * (2.0 * t_1);
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = c0 / (w * h)
t_1 = ((c0 / w) / h) * ((d_1 / d) ** 2.0d0)
t_2 = c0 / (2.0d0 * w)
t_3 = t_2 * 0.0d0
if (c0 <= (-1.3d-154)) then
tmp = t_2 * ((t_0 * (1.0d0 / ((d / d_1) * (d / d_1)))) + t_1)
else if (c0 <= 9.2d-38) then
tmp = t_3
else if (c0 <= 5.6d+72) then
tmp = t_2 * (t_1 + (t_0 * ((d_1 / d) * (d_1 / d))))
else if (c0 <= 3.9d+101) then
tmp = t_3
else
tmp = t_2 * (2.0d0 * t_1)
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = ((c0 / w) / h) * Math.pow((d / D), 2.0);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * 0.0;
double tmp;
if (c0 <= -1.3e-154) {
tmp = t_2 * ((t_0 * (1.0 / ((D / d) * (D / d)))) + t_1);
} else if (c0 <= 9.2e-38) {
tmp = t_3;
} else if (c0 <= 5.6e+72) {
tmp = t_2 * (t_1 + (t_0 * ((d / D) * (d / D))));
} else if (c0 <= 3.9e+101) {
tmp = t_3;
} else {
tmp = t_2 * (2.0 * t_1);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (w * h) t_1 = ((c0 / w) / h) * math.pow((d / D), 2.0) t_2 = c0 / (2.0 * w) t_3 = t_2 * 0.0 tmp = 0 if c0 <= -1.3e-154: tmp = t_2 * ((t_0 * (1.0 / ((D / d) * (D / d)))) + t_1) elif c0 <= 9.2e-38: tmp = t_3 elif c0 <= 5.6e+72: tmp = t_2 * (t_1 + (t_0 * ((d / D) * (d / D)))) elif c0 <= 3.9e+101: tmp = t_3 else: tmp = t_2 * (2.0 * t_1) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w * h)) t_1 = Float64(Float64(Float64(c0 / w) / h) * (Float64(d / D) ^ 2.0)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_2 * 0.0) tmp = 0.0 if (c0 <= -1.3e-154) tmp = Float64(t_2 * Float64(Float64(t_0 * Float64(1.0 / Float64(Float64(D / d) * Float64(D / d)))) + t_1)); elseif (c0 <= 9.2e-38) tmp = t_3; elseif (c0 <= 5.6e+72) tmp = Float64(t_2 * Float64(t_1 + Float64(t_0 * Float64(Float64(d / D) * Float64(d / D))))); elseif (c0 <= 3.9e+101) tmp = t_3; else tmp = Float64(t_2 * Float64(2.0 * t_1)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (w * h); t_1 = ((c0 / w) / h) * ((d / D) ^ 2.0); t_2 = c0 / (2.0 * w); t_3 = t_2 * 0.0; tmp = 0.0; if (c0 <= -1.3e-154) tmp = t_2 * ((t_0 * (1.0 / ((D / d) * (D / d)))) + t_1); elseif (c0 <= 9.2e-38) tmp = t_3; elseif (c0 <= 5.6e+72) tmp = t_2 * (t_1 + (t_0 * ((d / D) * (d / D)))); elseif (c0 <= 3.9e+101) tmp = t_3; else tmp = t_2 * (2.0 * t_1); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * 0.0), $MachinePrecision]}, If[LessEqual[c0, -1.3e-154], N[(t$95$2 * N[(N[(t$95$0 * N[(1.0 / N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 9.2e-38], t$95$3, If[LessEqual[c0, 5.6e+72], N[(t$95$2 * N[(t$95$1 + N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.9e+101], t$95$3, N[(t$95$2 * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t_2 \cdot 0\\
\mathbf{if}\;c0 \leq -1.3 \cdot 10^{-154}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \frac{1}{\frac{D}{d} \cdot \frac{D}{d}} + t_1\right)\\
\mathbf{elif}\;c0 \leq 9.2 \cdot 10^{-38}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 5.6 \cdot 10^{+72}:\\
\;\;\;\;t_2 \cdot \left(t_1 + t_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;c0 \leq 3.9 \cdot 10^{+101}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot t_1\right)\\
\end{array}
\end{array}
if c0 < -1.3e-154Initial program 31.2%
Simplified32.3%
Taylor expanded in c0 around inf 36.6%
*-commutative36.6%
*-commutative36.6%
associate-*r*36.6%
associate-/r*36.6%
associate-*l/37.7%
times-frac37.7%
unpow237.7%
associate-*r/38.8%
unpow238.8%
associate-/l/39.0%
associate-*r/37.9%
associate-*l/39.0%
unpow239.0%
Simplified39.0%
*-un-lft-identity39.0%
times-frac42.2%
pow242.2%
Applied egg-rr42.2%
/-rgt-identity42.2%
associate-*r/39.0%
unpow239.0%
frac-times47.6%
clear-num47.6%
clear-num47.6%
frac-times47.6%
metadata-eval47.6%
Applied egg-rr47.6%
if -1.3e-154 < c0 < 9.20000000000000007e-38 or 5.5999999999999998e72 < c0 < 3.9e101Initial program 18.1%
Simplified20.4%
Taylor expanded in c0 around -inf 6.2%
associate-*r*6.2%
neg-mul-16.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft53.2%
distribute-lft-neg-in53.2%
distribute-rgt-neg-in53.2%
metadata-eval53.2%
mul0-lft6.2%
metadata-eval6.2%
distribute-lft1-in6.2%
distribute-lft-in6.2%
Simplified53.2%
if 9.20000000000000007e-38 < c0 < 5.5999999999999998e72Initial program 26.9%
Simplified27.0%
Taylor expanded in c0 around inf 42.7%
*-commutative42.7%
*-commutative42.7%
associate-*r*42.7%
associate-/r*43.0%
associate-*l/43.0%
times-frac43.0%
unpow243.0%
associate-*r/43.0%
unpow243.0%
associate-/l/43.0%
associate-*r/43.0%
associate-*l/43.0%
unpow243.0%
Simplified43.0%
frac-times52.2%
Applied egg-rr52.2%
if 3.9e101 < c0 Initial program 21.1%
Simplified21.0%
Taylor expanded in c0 around inf 31.5%
*-commutative31.5%
*-commutative31.5%
associate-*r*31.4%
associate-/r*31.4%
associate-*l/31.5%
times-frac33.3%
unpow233.3%
associate-*r/39.1%
unpow239.1%
associate-/l/39.2%
associate-*r/39.1%
associate-*l/40.9%
unpow240.9%
Simplified40.9%
Final simplification48.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))))
(if (or (<= c0 -1.6e-154)
(not
(or (<= c0 5.8e-38) (and (not (<= c0 5.4e+72)) (<= c0 3.4e+101)))))
(* t_0 (* 2.0 (* (/ (/ c0 w) h) (pow (/ d D) 2.0))))
(* t_0 0.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if ((c0 <= -1.6e-154) || !((c0 <= 5.8e-38) || (!(c0 <= 5.4e+72) && (c0 <= 3.4e+101)))) {
tmp = t_0 * (2.0 * (((c0 / w) / h) * pow((d / D), 2.0)));
} else {
tmp = t_0 * 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) :: t_0
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
if ((c0 <= (-1.6d-154)) .or. (.not. (c0 <= 5.8d-38) .or. (.not. (c0 <= 5.4d+72)) .and. (c0 <= 3.4d+101))) then
tmp = t_0 * (2.0d0 * (((c0 / w) / h) * ((d_1 / d) ** 2.0d0)))
else
tmp = t_0 * 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 t_0 = c0 / (2.0 * w);
double tmp;
if ((c0 <= -1.6e-154) || !((c0 <= 5.8e-38) || (!(c0 <= 5.4e+72) && (c0 <= 3.4e+101)))) {
tmp = t_0 * (2.0 * (((c0 / w) / h) * Math.pow((d / D), 2.0)));
} else {
tmp = t_0 * 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) tmp = 0 if (c0 <= -1.6e-154) or not ((c0 <= 5.8e-38) or (not (c0 <= 5.4e+72) and (c0 <= 3.4e+101))): tmp = t_0 * (2.0 * (((c0 / w) / h) * math.pow((d / D), 2.0))) else: tmp = t_0 * 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if ((c0 <= -1.6e-154) || !((c0 <= 5.8e-38) || (!(c0 <= 5.4e+72) && (c0 <= 3.4e+101)))) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 / w) / h) * (Float64(d / D) ^ 2.0)))); else tmp = Float64(t_0 * 0.0); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); tmp = 0.0; if ((c0 <= -1.6e-154) || ~(((c0 <= 5.8e-38) || (~((c0 <= 5.4e+72)) && (c0 <= 3.4e+101))))) tmp = t_0 * (2.0 * (((c0 / w) / h) * ((d / D) ^ 2.0))); else tmp = t_0 * 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]}, If[Or[LessEqual[c0, -1.6e-154], N[Not[Or[LessEqual[c0, 5.8e-38], And[N[Not[LessEqual[c0, 5.4e+72]], $MachinePrecision], LessEqual[c0, 3.4e+101]]]], $MachinePrecision]], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 0.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -1.6 \cdot 10^{-154} \lor \neg \left(c0 \leq 5.8 \cdot 10^{-38} \lor \neg \left(c0 \leq 5.4 \cdot 10^{+72}\right) \land c0 \leq 3.4 \cdot 10^{+101}\right):\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0\\
\end{array}
\end{array}
if c0 < -1.60000000000000002e-154 or 5.79999999999999988e-38 < c0 < 5.4000000000000001e72 or 3.40000000000000017e101 < c0 Initial program 27.5%
Simplified28.0%
Taylor expanded in c0 around inf 36.8%
*-commutative36.8%
*-commutative36.8%
associate-*r*36.9%
associate-/r*36.9%
associate-*l/37.5%
times-frac37.1%
unpow237.1%
associate-*r/41.7%
unpow241.7%
associate-/l/44.6%
associate-*r/45.1%
associate-*l/46.2%
unpow246.2%
Simplified46.2%
if -1.60000000000000002e-154 < c0 < 5.79999999999999988e-38 or 5.4000000000000001e72 < c0 < 3.40000000000000017e101Initial program 18.1%
Simplified20.4%
Taylor expanded in c0 around -inf 6.2%
associate-*r*6.2%
neg-mul-16.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft53.2%
distribute-lft-neg-in53.2%
distribute-rgt-neg-in53.2%
metadata-eval53.2%
mul0-lft6.2%
metadata-eval6.2%
distribute-lft1-in6.2%
distribute-lft-in6.2%
Simplified53.2%
Final simplification48.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))))
(if (or (<= c0 -1e-153)
(and (not (<= c0 8.6e-38))
(or (<= c0 4.9e+72) (not (<= c0 3.5e+101)))))
(*
t_0
(+
(* (/ c0 (* w h)) (* (/ d D) (/ d D)))
(/ (* d (* c0 (/ d D))) (* (* w h) D))))
(* t_0 0.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if ((c0 <= -1e-153) || (!(c0 <= 8.6e-38) && ((c0 <= 4.9e+72) || !(c0 <= 3.5e+101)))) {
tmp = t_0 * (((c0 / (w * h)) * ((d / D) * (d / D))) + ((d * (c0 * (d / D))) / ((w * h) * D)));
} else {
tmp = t_0 * 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) :: t_0
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
if ((c0 <= (-1d-153)) .or. (.not. (c0 <= 8.6d-38)) .and. (c0 <= 4.9d+72) .or. (.not. (c0 <= 3.5d+101))) then
tmp = t_0 * (((c0 / (w * h)) * ((d_1 / d) * (d_1 / d))) + ((d_1 * (c0 * (d_1 / d))) / ((w * h) * d)))
else
tmp = t_0 * 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 t_0 = c0 / (2.0 * w);
double tmp;
if ((c0 <= -1e-153) || (!(c0 <= 8.6e-38) && ((c0 <= 4.9e+72) || !(c0 <= 3.5e+101)))) {
tmp = t_0 * (((c0 / (w * h)) * ((d / D) * (d / D))) + ((d * (c0 * (d / D))) / ((w * h) * D)));
} else {
tmp = t_0 * 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) tmp = 0 if (c0 <= -1e-153) or (not (c0 <= 8.6e-38) and ((c0 <= 4.9e+72) or not (c0 <= 3.5e+101))): tmp = t_0 * (((c0 / (w * h)) * ((d / D) * (d / D))) + ((d * (c0 * (d / D))) / ((w * h) * D))) else: tmp = t_0 * 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if ((c0 <= -1e-153) || (!(c0 <= 8.6e-38) && ((c0 <= 4.9e+72) || !(c0 <= 3.5e+101)))) tmp = Float64(t_0 * Float64(Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d / D) * Float64(d / D))) + Float64(Float64(d * Float64(c0 * Float64(d / D))) / Float64(Float64(w * h) * D)))); else tmp = Float64(t_0 * 0.0); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); tmp = 0.0; if ((c0 <= -1e-153) || (~((c0 <= 8.6e-38)) && ((c0 <= 4.9e+72) || ~((c0 <= 3.5e+101))))) tmp = t_0 * (((c0 / (w * h)) * ((d / D) * (d / D))) + ((d * (c0 * (d / D))) / ((w * h) * D))); else tmp = t_0 * 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]}, If[Or[LessEqual[c0, -1e-153], And[N[Not[LessEqual[c0, 8.6e-38]], $MachinePrecision], Or[LessEqual[c0, 4.9e+72], N[Not[LessEqual[c0, 3.5e+101]], $MachinePrecision]]]], N[(t$95$0 * N[(N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(d * N[(c0 * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 0.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -1 \cdot 10^{-153} \lor \neg \left(c0 \leq 8.6 \cdot 10^{-38}\right) \land \left(c0 \leq 4.9 \cdot 10^{+72} \lor \neg \left(c0 \leq 3.5 \cdot 10^{+101}\right)\right):\\
\;\;\;\;t_0 \cdot \left(\frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) + \frac{d \cdot \left(c0 \cdot \frac{d}{D}\right)}{\left(w \cdot h\right) \cdot D}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0\\
\end{array}
\end{array}
if c0 < -1.00000000000000004e-153 or 8.6000000000000004e-38 < c0 < 4.90000000000000006e72 or 3.50000000000000023e101 < c0 Initial program 27.5%
Simplified28.0%
Taylor expanded in c0 around inf 35.9%
*-commutative35.9%
*-commutative35.9%
associate-*r*35.9%
associate-/r*35.3%
associate-*l/36.0%
times-frac36.6%
unpow236.6%
associate-*r/37.1%
unpow237.1%
associate-/l/37.3%
associate-*r/36.7%
associate-*l/37.3%
unpow237.3%
Simplified37.3%
frac-times45.7%
Applied egg-rr45.7%
associate-/r*45.7%
pow245.7%
associate-*r*45.8%
*-commutative45.8%
associate-*r/45.7%
frac-times45.1%
Applied egg-rr45.1%
if -1.00000000000000004e-153 < c0 < 8.6000000000000004e-38 or 4.90000000000000006e72 < c0 < 3.50000000000000023e101Initial program 18.1%
Simplified20.4%
Taylor expanded in c0 around -inf 6.2%
associate-*r*6.2%
neg-mul-16.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft53.2%
distribute-lft-neg-in53.2%
distribute-rgt-neg-in53.2%
metadata-eval53.2%
mul0-lft6.2%
metadata-eval6.2%
distribute-lft1-in6.2%
distribute-lft-in6.2%
Simplified53.2%
Final simplification47.8%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ c0 (* w h)) (* (/ d D) (/ d D)))) (t_1 (/ c0 (* 2.0 w))))
(if (<= c0 -9.2e-153)
(* t_1 (+ t_0 (/ (* d (/ d D)) (* D (/ h (/ c0 w))))))
(if (or (<= c0 8.8e-38) (and (not (<= c0 6.1e+72)) (<= c0 4.6e+101)))
(* t_1 0.0)
(* t_1 (+ t_0 (/ (* d (* c0 (/ d D))) (* (* w h) D))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d / D) * (d / D));
double t_1 = c0 / (2.0 * w);
double tmp;
if (c0 <= -9.2e-153) {
tmp = t_1 * (t_0 + ((d * (d / D)) / (D * (h / (c0 / w)))));
} else if ((c0 <= 8.8e-38) || (!(c0 <= 6.1e+72) && (c0 <= 4.6e+101))) {
tmp = t_1 * 0.0;
} else {
tmp = t_1 * (t_0 + ((d * (c0 * (d / D))) / ((w * h) * D)));
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (c0 / (w * h)) * ((d_1 / d) * (d_1 / d))
t_1 = c0 / (2.0d0 * w)
if (c0 <= (-9.2d-153)) then
tmp = t_1 * (t_0 + ((d_1 * (d_1 / d)) / (d * (h / (c0 / w)))))
else if ((c0 <= 8.8d-38) .or. (.not. (c0 <= 6.1d+72)) .and. (c0 <= 4.6d+101)) then
tmp = t_1 * 0.0d0
else
tmp = t_1 * (t_0 + ((d_1 * (c0 * (d_1 / d))) / ((w * h) * d)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d / D) * (d / D));
double t_1 = c0 / (2.0 * w);
double tmp;
if (c0 <= -9.2e-153) {
tmp = t_1 * (t_0 + ((d * (d / D)) / (D * (h / (c0 / w)))));
} else if ((c0 <= 8.8e-38) || (!(c0 <= 6.1e+72) && (c0 <= 4.6e+101))) {
tmp = t_1 * 0.0;
} else {
tmp = t_1 * (t_0 + ((d * (c0 * (d / D))) / ((w * h) * D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / (w * h)) * ((d / D) * (d / D)) t_1 = c0 / (2.0 * w) tmp = 0 if c0 <= -9.2e-153: tmp = t_1 * (t_0 + ((d * (d / D)) / (D * (h / (c0 / w))))) elif (c0 <= 8.8e-38) or (not (c0 <= 6.1e+72) and (c0 <= 4.6e+101)): tmp = t_1 * 0.0 else: tmp = t_1 * (t_0 + ((d * (c0 * (d / D))) / ((w * h) * D))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d / D) * Float64(d / D))) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -9.2e-153) tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(d * Float64(d / D)) / Float64(D * Float64(h / Float64(c0 / w)))))); elseif ((c0 <= 8.8e-38) || (!(c0 <= 6.1e+72) && (c0 <= 4.6e+101))) tmp = Float64(t_1 * 0.0); else tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(d * Float64(c0 * Float64(d / D))) / Float64(Float64(w * h) * D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / (w * h)) * ((d / D) * (d / D)); t_1 = c0 / (2.0 * w); tmp = 0.0; if (c0 <= -9.2e-153) tmp = t_1 * (t_0 + ((d * (d / D)) / (D * (h / (c0 / w))))); elseif ((c0 <= 8.8e-38) || (~((c0 <= 6.1e+72)) && (c0 <= 4.6e+101))) tmp = t_1 * 0.0; else tmp = t_1 * (t_0 + ((d * (c0 * (d / D))) / ((w * h) * D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -9.2e-153], N[(t$95$1 * N[(t$95$0 + N[(N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(D * N[(h / N[(c0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c0, 8.8e-38], And[N[Not[LessEqual[c0, 6.1e+72]], $MachinePrecision], LessEqual[c0, 4.6e+101]]], N[(t$95$1 * 0.0), $MachinePrecision], N[(t$95$1 * N[(t$95$0 + N[(N[(d * N[(c0 * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -9.2 \cdot 10^{-153}:\\
\;\;\;\;t_1 \cdot \left(t_0 + \frac{d \cdot \frac{d}{D}}{D \cdot \frac{h}{\frac{c0}{w}}}\right)\\
\mathbf{elif}\;c0 \leq 8.8 \cdot 10^{-38} \lor \neg \left(c0 \leq 6.1 \cdot 10^{+72}\right) \land c0 \leq 4.6 \cdot 10^{+101}:\\
\;\;\;\;t_1 \cdot 0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 + \frac{d \cdot \left(c0 \cdot \frac{d}{D}\right)}{\left(w \cdot h\right) \cdot D}\right)\\
\end{array}
\end{array}
if c0 < -9.19999999999999988e-153Initial program 31.2%
Simplified32.3%
Taylor expanded in c0 around inf 36.6%
*-commutative36.6%
*-commutative36.6%
associate-*r*36.6%
associate-/r*36.6%
associate-*l/37.7%
times-frac37.7%
unpow237.7%
associate-*r/38.8%
unpow238.8%
associate-/l/39.0%
associate-*r/37.9%
associate-*l/39.0%
unpow239.0%
Simplified39.0%
frac-times47.6%
Applied egg-rr47.6%
associate-/r*47.6%
pow247.6%
*-commutative47.6%
associate-*r/47.6%
associate-/r*47.6%
clear-num47.6%
frac-times46.5%
Applied egg-rr46.5%
if -9.19999999999999988e-153 < c0 < 8.80000000000000029e-38 or 6.09999999999999991e72 < c0 < 4.6000000000000003e101Initial program 18.1%
Simplified20.4%
Taylor expanded in c0 around -inf 6.2%
associate-*r*6.2%
neg-mul-16.2%
distribute-lft1-in6.2%
metadata-eval6.2%
mul0-lft53.2%
distribute-lft-neg-in53.2%
distribute-rgt-neg-in53.2%
metadata-eval53.2%
mul0-lft6.2%
metadata-eval6.2%
distribute-lft1-in6.2%
distribute-lft-in6.2%
Simplified53.2%
if 8.80000000000000029e-38 < c0 < 6.09999999999999991e72 or 4.6000000000000003e101 < c0 Initial program 23.0%
Simplified23.0%
Taylor expanded in c0 around inf 35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
associate-/r*33.9%
associate-*l/33.9%
times-frac35.2%
unpow235.2%
associate-*r/35.2%
unpow235.2%
associate-/l/35.2%
associate-*r/35.2%
associate-*l/35.2%
unpow235.2%
Simplified35.2%
frac-times43.4%
Applied egg-rr43.4%
associate-/r*43.4%
pow243.4%
associate-*r*43.6%
*-commutative43.6%
associate-*r/43.5%
frac-times43.5%
Applied egg-rr43.5%
Final simplification47.8%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 (* 2.0 w)) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * 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 = (c0 / (2.0d0 * w)) * 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * 0.0;
}
def code(c0, w, h, D, d, M): return (c0 / (2.0 * w)) * 0.0
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * 0.0) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (2.0 * w)) * 0.0; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * 0.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{2 \cdot w} \cdot 0
\end{array}
Initial program 24.4%
Simplified25.5%
Taylor expanded in c0 around -inf 4.6%
associate-*r*4.6%
neg-mul-14.6%
distribute-lft1-in4.6%
metadata-eval4.6%
mul0-lft33.6%
distribute-lft-neg-in33.6%
distribute-rgt-neg-in33.6%
metadata-eval33.6%
mul0-lft4.6%
metadata-eval4.6%
distribute-lft1-in4.6%
distribute-lft-in4.2%
Simplified33.6%
Final simplification33.6%
herbie shell --seed 2023331
(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))))))