\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
\mathbf{if}\;M \leq -1.3603938329136146 \cdot 10^{-61} \lor \neg \left(M \leq 4.700540983952727 \cdot 10^{+104}\right):\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)\\
\end{array}
(FPCore (c0 w h D d M)
: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))))))(FPCore (c0 w h D d M)
:precision binary64
(if (or (<= M -1.3603938329136146e-61) (not (<= M 4.700540983952727e+104)))
(* 0.25 (* (/ (* D D) d) (/ (* M (* M h)) d)))
(*
0.25
(* (/ D (* (cbrt d) (cbrt d))) (* (/ D (cbrt d)) (/ (* h (* M M)) d))))))double code(double c0, double w, double h, double D, double d, double M) {
return (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)));
}
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M <= -1.3603938329136146e-61) || !(M <= 4.700540983952727e+104)) {
tmp = 0.25 * (((D * D) / d) * ((M * (M * h)) / d));
} else {
tmp = 0.25 * ((D / (cbrt(d) * cbrt(d))) * ((D / cbrt(d)) * ((h * (M * M)) / d)));
}
return tmp;
}



Bits error versus c0



Bits error versus w



Bits error versus h



Bits error versus D



Bits error versus d



Bits error versus M
Results
if M < -1.3603938329136146e-61 or 4.70054098395272706e104 < M Initial program 63.0
Taylor expanded in c0 around -inf 51.7
Taylor expanded in c0 around 0 46.9
Applied add-sqr-sqrt_binary6454.9
Applied unpow-prod-down_binary6454.9
Applied times-frac_binary6453.9
Simplified53.9
Simplified44.8
Applied associate-*r*_binary6438.4
if -1.3603938329136146e-61 < M < 4.70054098395272706e104Initial program 58.3
Taylor expanded in c0 around -inf 37.3
Taylor expanded in c0 around 0 30.0
Applied add-sqr-sqrt_binary6447.1
Applied unpow-prod-down_binary6447.1
Applied times-frac_binary6445.4
Simplified45.4
Simplified26.6
Applied add-cube-cbrt_binary6426.7
Applied times-frac_binary6423.7
Applied associate-*l*_binary6422.1
Final simplification27.4
herbie shell --seed 2022072
(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))))))