\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\begin{array}{l}
\mathbf{if}\;\ell \le -2.299316884642459 \cdot 10^{-151}:\\
\;\;\;\;\left({\left(\frac{\sqrt[3]{d} \cdot \sqrt[3]{d}}{\sqrt[3]{h} \cdot \sqrt[3]{h}}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{\sqrt[3]{d}}{\sqrt[3]{h}}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(\left({\left(\frac{1}{\sqrt[3]{\ell} \cdot \sqrt[3]{\ell}}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\sqrt[3]{\ell}}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left({\left(\frac{\sqrt[3]{d} \cdot \sqrt[3]{d}}{\sqrt[3]{h} \cdot \sqrt[3]{h}}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{\sqrt[3]{d}}{\sqrt[3]{h}}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left({\left(\frac{1}{\sqrt[3]{\ell} \cdot \sqrt[3]{\ell}}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\sqrt[3]{\ell}}\right)}^{\left(\frac{1}{2}\right)}\right)\right) \cdot \left(1 - \frac{\left(1 \cdot {\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)}^{2}\right) \cdot h}{2 \cdot \ell}\right)\\
\end{array}double code(double d, double h, double l, double M, double D) {
return ((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))));
}
double code(double d, double h, double l, double M, double D) {
double VAR;
if ((l <= -2.299316884642459e-151)) {
VAR = ((pow(((cbrt(d) * cbrt(d)) / (cbrt(h) * cbrt(h))), (1.0 / 2.0)) * pow((cbrt(d) / cbrt(h)), (1.0 / 2.0))) * ((pow((1.0 / (cbrt(l) * cbrt(l))), (1.0 / 2.0)) * pow((d / cbrt(l)), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))));
} else {
VAR = (((pow(((cbrt(d) * cbrt(d)) / (cbrt(h) * cbrt(h))), (1.0 / 2.0)) * pow((cbrt(d) / cbrt(h)), (1.0 / 2.0))) * (pow((1.0 / (cbrt(l) * cbrt(l))), (1.0 / 2.0)) * pow((d / cbrt(l)), (1.0 / 2.0)))) * (1.0 - (((1.0 * pow(((M * D) * (1.0 / (2.0 * d))), 2.0)) * h) / (2.0 * l))));
}
return VAR;
}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
Results
if l < -2.299316884642459e-151Initial program 24.8
rmApplied add-cube-cbrt25.0
Applied add-cube-cbrt25.1
Applied times-frac25.1
Applied unpow-prod-down19.3
rmApplied add-cube-cbrt19.3
Applied *-un-lft-identity19.3
Applied times-frac19.3
Applied unpow-prod-down16.1
rmApplied associate-*l*15.6
if -2.299316884642459e-151 < l Initial program 27.6
rmApplied add-cube-cbrt27.8
Applied add-cube-cbrt27.9
Applied times-frac27.9
Applied unpow-prod-down23.1
rmApplied add-cube-cbrt23.2
Applied *-un-lft-identity23.2
Applied times-frac23.2
Applied unpow-prod-down19.3
rmApplied associate-*l/19.3
Applied frac-times15.2
rmApplied div-inv15.2
Final simplification15.4
herbie shell --seed 2020100 +o rules:numerics
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1 2)) (pow (/ d l) (/ 1 2))) (- 1 (* (* (/ 1 2) (pow (/ (* M D) (* 2 d)) 2)) (/ h l)))))