
(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 (/ (/ d D) w)) (t_1 (/ c0 (* 2.0 w))))
(if (<= c0 -1e-60)
(* t_1 (* 2.0 (* c0 (* (pow (/ h (/ d D)) -1.0) t_0))))
(if (<= c0 2.05e-81)
(*
t_1
(fma
0.5
(/ (* h (* w (pow M 2.0))) (* c0 (pow (/ d D) 2.0)))
(* c0 0.0)))
(* t_1 (* 2.0 (* c0 (* t_0 (/ (/ d D) h)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) / w;
double t_1 = c0 / (2.0 * w);
double tmp;
if (c0 <= -1e-60) {
tmp = t_1 * (2.0 * (c0 * (pow((h / (d / D)), -1.0) * t_0)));
} else if (c0 <= 2.05e-81) {
tmp = t_1 * fma(0.5, ((h * (w * pow(M, 2.0))) / (c0 * pow((d / D), 2.0))), (c0 * 0.0));
} else {
tmp = t_1 * (2.0 * (c0 * (t_0 * ((d / D) / h))));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d / D) / w) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -1e-60) tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64((Float64(h / Float64(d / D)) ^ -1.0) * t_0)))); elseif (c0 <= 2.05e-81) tmp = Float64(t_1 * fma(0.5, Float64(Float64(h * Float64(w * (M ^ 2.0))) / Float64(c0 * (Float64(d / D) ^ 2.0))), Float64(c0 * 0.0))); else tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64(t_0 * Float64(Float64(d / D) / h))))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] / w), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1e-60], N[(t$95$1 * N[(2.0 * N[(c0 * N[(N[Power[N[(h / N[(d / D), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 2.05e-81], N[(t$95$1 * N[(0.5 * N[(N[(h * N[(w * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(2.0 * N[(c0 * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{d}{D}}{w}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -1 \cdot 10^{-60}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \left({\left(\frac{h}{\frac{d}{D}}\right)}^{-1} \cdot t_0\right)\right)\right)\\
\mathbf{elif}\;c0 \leq 2.05 \cdot 10^{-81}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(0.5, \frac{h \cdot \left(w \cdot {M}^{2}\right)}{c0 \cdot {\left(\frac{d}{D}\right)}^{2}}, c0 \cdot 0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \left(t_0 \cdot \frac{\frac{d}{D}}{h}\right)\right)\right)\\
\end{array}
\end{array}
if c0 < -9.9999999999999997e-61Initial program 30.8%
+-commutative30.8%
+-commutative30.8%
times-frac29.0%
fma-neg29.0%
Simplified30.9%
Taylor expanded in c0 around inf 35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*31.2%
associate-*r/31.3%
associate-*r*35.2%
*-commutative35.2%
*-commutative35.2%
associate-/r*33.3%
unpow233.3%
associate-*r/39.2%
unpow239.2%
associate-/l/51.2%
associate-*r/50.2%
associate-*l/52.3%
unpow252.3%
Simplified52.3%
unpow252.3%
Applied egg-rr52.3%
times-frac55.1%
Applied egg-rr55.1%
clear-num55.1%
inv-pow55.1%
Applied egg-rr55.1%
if -9.9999999999999997e-61 < c0 < 2.04999999999999992e-81Initial program 15.1%
associate-*r*13.9%
associate-*r*13.9%
times-frac13.9%
Applied egg-rr13.9%
Taylor expanded in c0 around -inf 4.2%
Simplified45.9%
if 2.04999999999999992e-81 < c0 Initial program 27.8%
+-commutative27.8%
+-commutative27.8%
times-frac26.7%
fma-neg26.7%
Simplified29.0%
Taylor expanded in c0 around inf 36.3%
*-commutative36.3%
*-commutative36.3%
associate-*r*37.5%
associate-*r/38.2%
associate-*r*37.5%
*-commutative37.5%
*-commutative37.5%
associate-/r*39.8%
unpow239.8%
associate-*r/47.7%
unpow247.7%
associate-/l/55.6%
associate-*r/49.9%
associate-*l/56.4%
unpow256.4%
Simplified56.4%
unpow256.4%
Applied egg-rr56.4%
times-frac61.8%
Applied egg-rr61.8%
Final simplification54.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ d D) w)) (t_1 (/ c0 (* 2.0 w))))
(if (<= c0 -4.8e-63)
(* t_1 (* 2.0 (* c0 (* (pow (/ h (/ d D)) -1.0) t_0))))
(if (<= c0 1.3e-81) 0.0 (* t_1 (* 2.0 (* c0 (* t_0 (/ (/ d D) h)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) / w;
double t_1 = c0 / (2.0 * w);
double tmp;
if (c0 <= -4.8e-63) {
tmp = t_1 * (2.0 * (c0 * (pow((h / (d / D)), -1.0) * t_0)));
} else if (c0 <= 1.3e-81) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * (c0 * (t_0 * ((d / D) / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / d) / w
t_1 = c0 / (2.0d0 * w)
if (c0 <= (-4.8d-63)) then
tmp = t_1 * (2.0d0 * (c0 * (((h / (d_1 / d)) ** (-1.0d0)) * t_0)))
else if (c0 <= 1.3d-81) then
tmp = 0.0d0
else
tmp = t_1 * (2.0d0 * (c0 * (t_0 * ((d_1 / d) / h))))
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 = (d / D) / w;
double t_1 = c0 / (2.0 * w);
double tmp;
if (c0 <= -4.8e-63) {
tmp = t_1 * (2.0 * (c0 * (Math.pow((h / (d / D)), -1.0) * t_0)));
} else if (c0 <= 1.3e-81) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * (c0 * (t_0 * ((d / D) / h))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d / D) / w t_1 = c0 / (2.0 * w) tmp = 0 if c0 <= -4.8e-63: tmp = t_1 * (2.0 * (c0 * (math.pow((h / (d / D)), -1.0) * t_0))) elif c0 <= 1.3e-81: tmp = 0.0 else: tmp = t_1 * (2.0 * (c0 * (t_0 * ((d / D) / h)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d / D) / w) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -4.8e-63) tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64((Float64(h / Float64(d / D)) ^ -1.0) * t_0)))); elseif (c0 <= 1.3e-81) tmp = 0.0; else tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64(t_0 * Float64(Float64(d / D) / h))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) / w; t_1 = c0 / (2.0 * w); tmp = 0.0; if (c0 <= -4.8e-63) tmp = t_1 * (2.0 * (c0 * (((h / (d / D)) ^ -1.0) * t_0))); elseif (c0 <= 1.3e-81) tmp = 0.0; else tmp = t_1 * (2.0 * (c0 * (t_0 * ((d / D) / h)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] / w), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -4.8e-63], N[(t$95$1 * N[(2.0 * N[(c0 * N[(N[Power[N[(h / N[(d / D), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1.3e-81], 0.0, N[(t$95$1 * N[(2.0 * N[(c0 * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{d}{D}}{w}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -4.8 \cdot 10^{-63}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \left({\left(\frac{h}{\frac{d}{D}}\right)}^{-1} \cdot t_0\right)\right)\right)\\
\mathbf{elif}\;c0 \leq 1.3 \cdot 10^{-81}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \left(t_0 \cdot \frac{\frac{d}{D}}{h}\right)\right)\right)\\
\end{array}
\end{array}
if c0 < -4.8000000000000001e-63Initial program 30.5%
+-commutative30.5%
+-commutative30.5%
times-frac28.7%
fma-neg28.7%
Simplified30.6%
Taylor expanded in c0 around inf 34.8%
*-commutative34.8%
*-commutative34.8%
associate-*r*30.9%
associate-*r/31.0%
associate-*r*34.8%
*-commutative34.8%
*-commutative34.8%
associate-/r*32.9%
unpow232.9%
associate-*r/38.7%
unpow238.7%
associate-/l/51.8%
associate-*r/50.7%
associate-*l/52.8%
unpow252.8%
Simplified52.8%
unpow252.8%
Applied egg-rr52.8%
times-frac55.6%
Applied egg-rr55.6%
clear-num55.6%
inv-pow55.6%
Applied egg-rr55.6%
if -4.8000000000000001e-63 < c0 < 1.2999999999999999e-81Initial program 15.3%
+-commutative15.3%
+-commutative15.3%
times-frac12.5%
fma-neg12.5%
Simplified15.4%
Taylor expanded in c0 around -inf 4.2%
associate-*r*4.2%
neg-mul-14.2%
distribute-lft1-in4.2%
metadata-eval4.2%
mul0-lft44.6%
distribute-lft-neg-in44.6%
distribute-rgt-neg-in44.6%
metadata-eval44.6%
mul0-lft4.2%
metadata-eval4.2%
distribute-lft1-in4.2%
distribute-lft-in4.2%
Simplified44.6%
Taylor expanded in c0 around 0 44.6%
if 1.2999999999999999e-81 < c0 Initial program 27.8%
+-commutative27.8%
+-commutative27.8%
times-frac26.7%
fma-neg26.7%
Simplified29.0%
Taylor expanded in c0 around inf 36.3%
*-commutative36.3%
*-commutative36.3%
associate-*r*37.5%
associate-*r/38.2%
associate-*r*37.5%
*-commutative37.5%
*-commutative37.5%
associate-/r*39.8%
unpow239.8%
associate-*r/47.7%
unpow247.7%
associate-/l/55.6%
associate-*r/49.9%
associate-*l/56.4%
unpow256.4%
Simplified56.4%
unpow256.4%
Applied egg-rr56.4%
times-frac61.8%
Applied egg-rr61.8%
Final simplification54.6%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -2.75e-62) (not (<= c0 9e-86))) (* (/ c0 (* 2.0 w)) (* 2.0 (* c0 (* (/ (/ d D) w) (/ (/ d D) h))))) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -2.75e-62) || !(c0 <= 9e-86)) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) / w) * ((d / D) / h))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((c0 <= (-2.75d-62)) .or. (.not. (c0 <= 9d-86))) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 * (((d_1 / d) / w) * ((d_1 / d) / h))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -2.75e-62) || !(c0 <= 9e-86)) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) / w) * ((d / D) / h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -2.75e-62) or not (c0 <= 9e-86): tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) / w) * ((d / D) / h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -2.75e-62) || !(c0 <= 9e-86)) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 * Float64(Float64(Float64(d / D) / w) * Float64(Float64(d / D) / h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -2.75e-62) || ~((c0 <= 9e-86))) tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) / w) * ((d / D) / h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -2.75e-62], N[Not[LessEqual[c0, 9e-86]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(N[(d / D), $MachinePrecision] / w), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -2.75 \cdot 10^{-62} \lor \neg \left(c0 \leq 9 \cdot 10^{-86}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{\frac{d}{D}}{w} \cdot \frac{\frac{d}{D}}{h}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if c0 < -2.75000000000000011e-62 or 8.9999999999999995e-86 < c0 Initial program 29.1%
+-commutative29.1%
+-commutative29.1%
times-frac27.7%
fma-neg27.7%
Simplified29.8%
Taylor expanded in c0 around inf 35.5%
*-commutative35.5%
*-commutative35.5%
associate-*r*34.2%
associate-*r/34.6%
associate-*r*36.2%
*-commutative36.2%
*-commutative36.2%
associate-/r*36.4%
unpow236.4%
associate-*r/43.2%
unpow243.2%
associate-/l/53.7%
associate-*r/50.3%
associate-*l/54.6%
unpow254.6%
Simplified54.6%
unpow254.6%
Applied egg-rr54.6%
times-frac58.7%
Applied egg-rr58.7%
if -2.75000000000000011e-62 < c0 < 8.9999999999999995e-86Initial program 15.3%
+-commutative15.3%
+-commutative15.3%
times-frac12.5%
fma-neg12.5%
Simplified15.4%
Taylor expanded in c0 around -inf 4.2%
associate-*r*4.2%
neg-mul-14.2%
distribute-lft1-in4.2%
metadata-eval4.2%
mul0-lft44.6%
distribute-lft-neg-in44.6%
distribute-rgt-neg-in44.6%
metadata-eval44.6%
mul0-lft4.2%
metadata-eval4.2%
distribute-lft1-in4.2%
distribute-lft-in4.2%
Simplified44.6%
Taylor expanded in c0 around 0 44.6%
Final simplification54.6%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= c0 -3.7e-63) (not (<= c0 2.4e-84))) (* (/ c0 w) (/ (* (* (/ d D) (/ d D)) (/ c0 h)) w)) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -3.7e-63) || !(c0 <= 2.4e-84)) {
tmp = (c0 / w) * ((((d / D) * (d / D)) * (c0 / h)) / 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 <= (-3.7d-63)) .or. (.not. (c0 <= 2.4d-84))) then
tmp = (c0 / w) * ((((d_1 / d) * (d_1 / d)) * (c0 / h)) / 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 <= -3.7e-63) || !(c0 <= 2.4e-84)) {
tmp = (c0 / w) * ((((d / D) * (d / D)) * (c0 / h)) / w);
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -3.7e-63) or not (c0 <= 2.4e-84): tmp = (c0 / w) * ((((d / D) * (d / D)) * (c0 / h)) / w) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -3.7e-63) || !(c0 <= 2.4e-84)) tmp = Float64(Float64(c0 / w) * Float64(Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / h)) / w)); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -3.7e-63) || ~((c0 <= 2.4e-84))) tmp = (c0 / w) * ((((d / D) * (d / D)) * (c0 / h)) / w); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -3.7e-63], N[Not[LessEqual[c0, 2.4e-84]], $MachinePrecision]], N[(N[(c0 / w), $MachinePrecision] * N[(N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -3.7 \cdot 10^{-63} \lor \neg \left(c0 \leq 2.4 \cdot 10^{-84}\right):\\
\;\;\;\;\frac{c0}{w} \cdot \frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{h}}{w}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if c0 < -3.70000000000000012e-63 or 2.40000000000000017e-84 < c0 Initial program 29.1%
+-commutative29.1%
+-commutative29.1%
times-frac27.7%
fma-neg27.7%
Simplified29.8%
Taylor expanded in c0 around inf 35.5%
*-commutative35.5%
*-commutative35.5%
associate-*r*34.2%
associate-*r/34.6%
associate-*r*36.2%
*-commutative36.2%
*-commutative36.2%
associate-/r*36.4%
unpow236.4%
associate-*r/43.2%
unpow243.2%
associate-/l/53.7%
associate-*r/50.3%
associate-*l/54.6%
unpow254.6%
Simplified54.6%
associate-*r/53.7%
*-commutative53.7%
associate-*l/54.6%
unpow254.6%
times-frac35.2%
times-frac35.5%
associate-*r*37.7%
associate-*r*43.4%
frac-times54.2%
associate-*r/52.7%
times-frac54.4%
*-commutative54.4%
Applied egg-rr54.4%
expm1-log1p-u32.0%
expm1-udef30.7%
associate-*r*30.7%
*-commutative30.7%
associate-/l*31.2%
associate-*l/30.1%
Applied egg-rr30.1%
expm1-def32.9%
expm1-log1p55.9%
associate-*l/55.9%
*-commutative55.9%
*-commutative55.9%
times-frac55.9%
metadata-eval55.9%
associate-/l/55.8%
*-commutative55.8%
times-frac54.6%
associate-/l*50.3%
associate-*r/54.6%
unpow254.6%
associate-/r*55.6%
associate-*r/55.2%
Simplified55.2%
unpow254.6%
Applied egg-rr55.2%
if -3.70000000000000012e-63 < c0 < 2.40000000000000017e-84Initial program 15.3%
+-commutative15.3%
+-commutative15.3%
times-frac12.5%
fma-neg12.5%
Simplified15.4%
Taylor expanded in c0 around -inf 4.2%
associate-*r*4.2%
neg-mul-14.2%
distribute-lft1-in4.2%
metadata-eval4.2%
mul0-lft44.6%
distribute-lft-neg-in44.6%
distribute-rgt-neg-in44.6%
metadata-eval44.6%
mul0-lft4.2%
metadata-eval4.2%
distribute-lft1-in4.2%
distribute-lft-in4.2%
Simplified44.6%
Taylor expanded in c0 around 0 44.6%
Final simplification52.1%
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
def code(c0, w, h, D, d, M): return 0.0
function code(c0, w, h, D, d, M) return 0.0 end
function tmp = code(c0, w, h, D, d, M) tmp = 0.0; end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 25.1%
+-commutative25.1%
+-commutative25.1%
times-frac23.3%
fma-neg23.3%
Simplified25.6%
Taylor expanded in c0 around -inf 5.9%
associate-*r*5.9%
neg-mul-15.9%
distribute-lft1-in5.9%
metadata-eval5.9%
mul0-lft26.7%
distribute-lft-neg-in26.7%
distribute-rgt-neg-in26.7%
metadata-eval26.7%
mul0-lft5.9%
metadata-eval5.9%
distribute-lft1-in5.9%
distribute-lft-in5.5%
Simplified26.7%
Taylor expanded in c0 around 0 27.4%
Final simplification27.4%
herbie shell --seed 2024023
(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))))))