
(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 5 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)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (* d d) (/ c0 (* D (* (* w h) D))))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * ((d * d) * (c0 / (D * ((w * h) * D)))));
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * ((d * d) * (c0 / (D * ((w * h) * D)))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * ((d * d) * (c0 / (D * ((w * h) * D))))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(d * d) * Float64(c0 / Float64(D * Float64(Float64(w * h) * D)))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * ((d * d) * (c0 / (D * ((w * h) * D))))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(d * d), $MachinePrecision] * N[(c0 / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.5%
Simplified68.0%
associate-*l/68.3%
associate-/l/68.3%
Applied egg-rr68.3%
times-frac69.2%
associate-/l*69.2%
Simplified69.2%
Taylor expanded in c0 around inf 77.1%
*-commutative77.1%
*-commutative77.1%
associate-*r*73.9%
unpow273.9%
associate-/l*73.0%
associate-/r/73.9%
unpow273.9%
*-commutative73.9%
unpow273.9%
unpow273.9%
Simplified73.9%
Taylor expanded in w around 0 77.1%
unpow277.1%
associate-*l*78.5%
Simplified78.5%
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%
Simplified3.1%
Taylor expanded in c0 around -inf 0.7%
mul-1-neg0.7%
*-commutative0.7%
distribute-rgt1-in0.7%
metadata-eval0.7%
mul0-lft33.2%
distribute-rgt-neg-in33.2%
metadata-eval33.2%
Simplified33.2%
Taylor expanded in c0 around 0 39.0%
Final simplification52.4%
(FPCore (c0 w h D d M)
:precision binary64
(if (or (<= c0 -1e-65)
(not
(or (<= c0 2.9e-232) (and (not (<= c0 4.5e-186)) (<= c0 1.42e-65)))))
(* (/ c0 (* 2.0 w)) (* 2.0 (* (/ c0 (* w h)) (* (/ d D) (/ d D)))))
0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -1e-65) || !((c0 <= 2.9e-232) || (!(c0 <= 4.5e-186) && (c0 <= 1.42e-65)))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d / D) * (d / D))));
} 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 ((c0 <= (-1d-65)) .or. (.not. (c0 <= 2.9d-232) .or. (.not. (c0 <= 4.5d-186)) .and. (c0 <= 1.42d-65))) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / (w * h)) * ((d_1 / d) * (d_1 / d))))
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 ((c0 <= -1e-65) || !((c0 <= 2.9e-232) || (!(c0 <= 4.5e-186) && (c0 <= 1.42e-65)))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d / D) * (d / D))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -1e-65) or not ((c0 <= 2.9e-232) or (not (c0 <= 4.5e-186) and (c0 <= 1.42e-65))): tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d / D) * (d / D)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -1e-65) || !((c0 <= 2.9e-232) || (!(c0 <= 4.5e-186) && (c0 <= 1.42e-65)))) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d / D) * Float64(d / D))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -1e-65) || ~(((c0 <= 2.9e-232) || (~((c0 <= 4.5e-186)) && (c0 <= 1.42e-65))))) tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d / D) * (d / D)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -1e-65], N[Not[Or[LessEqual[c0, 2.9e-232], And[N[Not[LessEqual[c0, 4.5e-186]], $MachinePrecision], LessEqual[c0, 1.42e-65]]]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -1 \cdot 10^{-65} \lor \neg \left(c0 \leq 2.9 \cdot 10^{-232} \lor \neg \left(c0 \leq 4.5 \cdot 10^{-186}\right) \land c0 \leq 1.42 \cdot 10^{-65}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if c0 < -9.99999999999999923e-66 or 2.8999999999999999e-232 < c0 < 4.4999999999999998e-186 or 1.41999999999999993e-65 < c0 Initial program 29.1%
Simplified37.8%
Taylor expanded in D around 0 9.8%
fma-def9.8%
Simplified38.3%
fma-udef38.3%
associate-/l/39.3%
*-commutative39.3%
pow239.3%
frac-times39.8%
mul0-rgt39.8%
*-commutative39.8%
frac-times45.4%
associate-/l/44.5%
*-commutative44.5%
associate-/l/45.4%
*-commutative45.4%
pow245.4%
Applied egg-rr45.4%
fma-def45.4%
*-commutative45.4%
fma-udef45.4%
mul0-rgt45.4%
unpow245.4%
*-commutative45.4%
div051.0%
metadata-eval51.0%
*-commutative51.0%
Simplified51.0%
associate-*l/49.2%
+-lft-identity49.2%
*-commutative49.2%
Applied egg-rr49.2%
*-commutative49.2%
associate-*r/51.0%
fma-def51.0%
count-251.0%
*-commutative51.0%
Simplified51.0%
pow251.0%
Applied egg-rr51.0%
if -9.99999999999999923e-66 < c0 < 2.8999999999999999e-232 or 4.4999999999999998e-186 < c0 < 1.41999999999999993e-65Initial program 15.8%
Simplified22.6%
Taylor expanded in c0 around -inf 3.4%
mul-1-neg3.4%
*-commutative3.4%
distribute-rgt1-in3.4%
metadata-eval3.4%
mul0-lft52.1%
distribute-rgt-neg-in52.1%
metadata-eval52.1%
Simplified52.1%
Taylor expanded in c0 around 0 52.1%
Final simplification51.3%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= M 1.48e-214)
0.0
(if (or (<= M 4.9e-149) (not (<= M 1.2e-27)))
(* (/ d (/ D d)) (/ (/ (* c0 (/ c0 h)) (* w w)) D))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 1.48e-214) {
tmp = 0.0;
} else if ((M <= 4.9e-149) || !(M <= 1.2e-27)) {
tmp = (d / (D / d)) * (((c0 * (c0 / h)) / (w * w)) / D);
} 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 (m <= 1.48d-214) then
tmp = 0.0d0
else if ((m <= 4.9d-149) .or. (.not. (m <= 1.2d-27))) then
tmp = (d_1 / (d / d_1)) * (((c0 * (c0 / h)) / (w * w)) / d)
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 (M <= 1.48e-214) {
tmp = 0.0;
} else if ((M <= 4.9e-149) || !(M <= 1.2e-27)) {
tmp = (d / (D / d)) * (((c0 * (c0 / h)) / (w * w)) / D);
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 1.48e-214: tmp = 0.0 elif (M <= 4.9e-149) or not (M <= 1.2e-27): tmp = (d / (D / d)) * (((c0 * (c0 / h)) / (w * w)) / D) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 1.48e-214) tmp = 0.0; elseif ((M <= 4.9e-149) || !(M <= 1.2e-27)) tmp = Float64(Float64(d / Float64(D / d)) * Float64(Float64(Float64(c0 * Float64(c0 / h)) / Float64(w * w)) / D)); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 1.48e-214) tmp = 0.0; elseif ((M <= 4.9e-149) || ~((M <= 1.2e-27))) tmp = (d / (D / d)) * (((c0 * (c0 / h)) / (w * w)) / D); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 1.48e-214], 0.0, If[Or[LessEqual[M, 4.9e-149], N[Not[LessEqual[M, 1.2e-27]], $MachinePrecision]], N[(N[(d / N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.48 \cdot 10^{-214}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 4.9 \cdot 10^{-149} \lor \neg \left(M \leq 1.2 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{d}{\frac{D}{d}} \cdot \frac{\frac{c0 \cdot \frac{c0}{h}}{w \cdot w}}{D}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if M < 1.48000000000000004e-214 or 4.9000000000000004e-149 < M < 1.20000000000000001e-27Initial program 28.2%
Simplified29.9%
Taylor expanded in c0 around -inf 6.4%
mul-1-neg6.4%
*-commutative6.4%
distribute-rgt1-in6.4%
metadata-eval6.4%
mul0-lft31.3%
distribute-rgt-neg-in31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in c0 around 0 36.0%
if 1.48000000000000004e-214 < M < 4.9000000000000004e-149 or 1.20000000000000001e-27 < M Initial program 20.8%
Simplified28.8%
Taylor expanded in D around 0 7.4%
fma-def7.4%
Simplified31.8%
fma-udef31.8%
associate-/l/31.9%
*-commutative31.9%
pow231.9%
frac-times31.9%
mul0-rgt31.9%
*-commutative31.9%
frac-times37.0%
associate-/l/36.9%
*-commutative36.9%
associate-/l/37.0%
*-commutative37.0%
pow237.0%
Applied egg-rr37.0%
fma-def37.0%
*-commutative37.0%
fma-udef37.0%
mul0-rgt37.0%
unpow237.0%
*-commutative37.0%
div046.2%
metadata-eval46.2%
*-commutative46.2%
Simplified46.2%
Taylor expanded in c0 around 0 28.3%
times-frac28.4%
unpow228.4%
unpow228.4%
unpow228.4%
*-commutative28.4%
unpow228.4%
Simplified28.4%
associate-*l/28.4%
times-frac30.1%
Applied egg-rr30.1%
unpow230.1%
times-frac37.8%
unpow237.8%
associate-/l*41.9%
unpow241.9%
associate-*r/40.5%
unpow240.5%
Simplified40.5%
Final simplification37.3%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -2.1e-65) (not (<= c0 5.4e-53))) (* (* (/ d D) (/ d D)) (/ (* c0 c0) (* h (* w w)))) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -2.1e-65) || !(c0 <= 5.4e-53)) {
tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (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 ((c0 <= (-2.1d-65)) .or. (.not. (c0 <= 5.4d-53))) then
tmp = ((d_1 / d) * (d_1 / d)) * ((c0 * c0) / (h * (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 ((c0 <= -2.1e-65) || !(c0 <= 5.4e-53)) {
tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -2.1e-65) or not (c0 <= 5.4e-53): tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -2.1e-65) || !(c0 <= 5.4e-53)) tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 * c0) / Float64(h * 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 ((c0 <= -2.1e-65) || ~((c0 <= 5.4e-53))) tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -2.1e-65], N[Not[LessEqual[c0, 5.4e-53]], $MachinePrecision]], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -2.1 \cdot 10^{-65} \lor \neg \left(c0 \leq 5.4 \cdot 10^{-53}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if c0 < -2.10000000000000003e-65 or 5.3999999999999998e-53 < c0 Initial program 29.5%
Simplified38.2%
Taylor expanded in D around 0 10.3%
fma-def10.3%
Simplified39.3%
fma-udef39.3%
associate-/l/39.9%
*-commutative39.9%
pow239.9%
frac-times40.4%
mul0-rgt40.4%
*-commutative40.4%
frac-times45.3%
associate-/l/44.9%
*-commutative44.9%
associate-/l/45.3%
*-commutative45.3%
pow245.3%
Applied egg-rr45.3%
fma-def45.3%
*-commutative45.3%
fma-udef45.3%
mul0-rgt45.3%
unpow245.3%
*-commutative45.3%
div050.2%
metadata-eval50.2%
*-commutative50.2%
Simplified50.2%
Taylor expanded in c0 around 0 34.1%
times-frac34.7%
unpow234.7%
unpow234.7%
unpow234.7%
*-commutative34.7%
unpow234.7%
Simplified34.7%
frac-times42.5%
Applied egg-rr42.5%
if -2.10000000000000003e-65 < c0 < 5.3999999999999998e-53Initial program 16.7%
Simplified22.5%
Taylor expanded in c0 around -inf 2.9%
mul-1-neg2.9%
*-commutative2.9%
distribute-rgt1-in2.9%
metadata-eval2.9%
mul0-lft47.1%
distribute-rgt-neg-in47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in c0 around 0 47.1%
Final simplification43.8%
(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.0%
Simplified27.6%
Taylor expanded in c0 around -inf 4.6%
mul-1-neg4.6%
*-commutative4.6%
distribute-rgt1-in4.6%
metadata-eval4.6%
mul0-lft26.4%
distribute-rgt-neg-in26.4%
metadata-eval26.4%
Simplified26.4%
Taylor expanded in c0 around 0 30.3%
Final simplification30.3%
herbie shell --seed 2023263
(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))))))