\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.5139383191211987 \cdot 10^{200}:\\
\;\;\;\;{\left(\frac{d}{h}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot \left(\left({\left(\frac{d}{h}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot e^{0.5 \cdot \left(\log \left(\frac{-1}{\ell}\right) - \log \left(\frac{-1}{d}\right)\right)}\right) \cdot \left(1 - \frac{1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)}}{2} \cdot \frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)} \cdot h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \le -3.6100708999966032 \cdot 10^{-66}:\\
\;\;\;\;\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 - \frac{1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)}}{2} \cdot \frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)} \cdot h}{\ell}\right)\\
\mathbf{elif}\;\ell \le -5.9473296884189744 \cdot 10^{-309}:\\
\;\;\;\;{\left(\frac{d}{h}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot \left(\left({\left(\frac{d}{h}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot e^{0.5 \cdot \left(\log \left(\frac{-1}{\ell}\right) - \log \left(\frac{-1}{d}\right)\right)}\right) \cdot \left(1 - \frac{1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)}}{2} \cdot \frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)} \cdot h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \le 4.4873787195281464 \cdot 10^{-102}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {d}^{\left(\frac{1}{2}\right)}\right) \cdot \left({\left(\frac{1}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \frac{1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)}}{2} \cdot \frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)} \cdot h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \le 1.34823184030168225 \cdot 10^{154}:\\
\;\;\;\;{d}^{\left(\frac{1}{2}\right)} \cdot \left(\left({\left(\frac{1}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{2 \cdot \ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {d}^{\left(\frac{1}{2}\right)}\right) \cdot \left({\left(\frac{1}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \frac{1 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)}}{2} \cdot \frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{\left(\frac{2}{2}\right)} \cdot h}{\ell}\right)\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.5139383191211987e+200)) {
VAR = (pow((d / h), ((1.0 / 2.0) / 2.0)) * ((pow((d / h), ((1.0 / 2.0) / 2.0)) * exp((0.5 * (log((-1.0 / l)) - log((-1.0 / d)))))) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), (2.0 / 2.0))) / 2.0) * ((pow(((M * D) / (2.0 * d)), (2.0 / 2.0)) * h) / l)))));
} else {
double VAR_1;
if ((l <= -3.610070899996603e-66)) {
VAR_1 = ((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), (2.0 / 2.0))) / 2.0) * ((pow(((M * D) / (2.0 * d)), (2.0 / 2.0)) * h) / l))));
} else {
double VAR_2;
if ((l <= -5.947329688418974e-309)) {
VAR_2 = (pow((d / h), ((1.0 / 2.0) / 2.0)) * ((pow((d / h), ((1.0 / 2.0) / 2.0)) * exp((0.5 * (log((-1.0 / l)) - log((-1.0 / d)))))) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), (2.0 / 2.0))) / 2.0) * ((pow(((M * D) / (2.0 * d)), (2.0 / 2.0)) * h) / l)))));
} else {
double VAR_3;
if ((l <= 4.4873787195281464e-102)) {
VAR_3 = ((pow((d / h), (1.0 / 2.0)) * pow(d, (1.0 / 2.0))) * (pow((1.0 / l), (1.0 / 2.0)) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), (2.0 / 2.0))) / 2.0) * ((pow(((M * D) / (2.0 * d)), (2.0 / 2.0)) * h) / l)))));
} else {
double VAR_4;
if ((l <= 1.3482318403016823e+154)) {
VAR_4 = (pow(d, (1.0 / 2.0)) * ((pow((1.0 / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), 2.0)) * h) / (2.0 * l)))));
} else {
VAR_4 = ((pow((d / h), (1.0 / 2.0)) * pow(d, (1.0 / 2.0))) * (pow((1.0 / l), (1.0 / 2.0)) * (1.0 - (((1.0 * pow(((M * D) / (2.0 * d)), (2.0 / 2.0))) / 2.0) * ((pow(((M * D) / (2.0 * d)), (2.0 / 2.0)) * h) / l)))));
}
VAR_3 = VAR_4;
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
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.5139383191211987e+200 or -3.610070899996603e-66 < l < -5.947329688418974e-309Initial program 30.7
rmApplied associate-*l/30.7
Applied frac-times28.2
rmApplied sqr-pow28.2
Applied associate-*r*28.2
Applied associate-*l*27.6
Applied times-frac27.1
rmApplied sqr-pow27.1
Applied associate-*l*27.2
Applied associate-*l*27.2
Taylor expanded around -inf 19.3
if -2.5139383191211987e+200 < l < -3.610070899996603e-66Initial program 22.9
rmApplied associate-*l/22.9
Applied frac-times23.5
rmApplied sqr-pow23.5
Applied associate-*r*23.5
Applied associate-*l*21.6
Applied times-frac20.0
if -5.947329688418974e-309 < l < 4.4873787195281464e-102 or 1.3482318403016823e+154 < l Initial program 31.5
rmApplied associate-*l/31.5
Applied frac-times30.5
rmApplied sqr-pow30.5
Applied associate-*r*30.5
Applied associate-*l*29.3
Applied times-frac28.1
rmApplied div-inv28.1
Applied unpow-prod-down16.8
Applied associate-*r*16.8
Applied associate-*l*17.3
if 4.4873787195281464e-102 < l < 1.3482318403016823e+154Initial program 20.6
rmApplied associate-*l/20.6
Applied frac-times20.4
rmApplied div-inv20.4
Applied unpow-prod-down13.7
Applied associate-*l*13.7
Applied associate-*l*13.4
Final simplification17.6
herbie shell --seed 2020071 +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)))))