\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}
t_0 := {\left(\frac{d}{\ell}\right)}^{0.5}\\
t_1 := \frac{D \cdot M}{d \cdot 2}\\
t_2 := {t_1}^{2}\\
t_3 := {\left(-d\right)}^{0.5}\\
\mathbf{if}\;d \leq -1.5325362465457807 \cdot 10^{-77}:\\
\;\;\;\;\left(\left(t_3 \cdot {\left(\frac{-1}{h}\right)}^{0.5}\right) \cdot t_0\right) \cdot \left(1 - h \cdot \left(\frac{0.5}{\ell} \cdot t_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := {\left(\frac{d}{h}\right)}^{0.5}\\
\mathbf{if}\;d \leq -2.941112501210015 \cdot 10^{-305}:\\
\;\;\;\;\left(t_4 \cdot \left(t_3 \cdot {\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right) \cdot \left(1 - \left(0.5 \cdot t_2\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;d \leq 3.5292094803642007 \cdot 10^{+121}:\\
\;\;\;\;\begin{array}{l}
t_5 := \left|t_1 \cdot \sqrt{\frac{0.5}{\ell}}\right| \cdot \sqrt{h}\\
\left(t_0 \cdot t_4\right) \cdot \left(1 - t_5 \cdot t_5\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}\\
\end{array}
(FPCore (d h l M D) :precision binary64 (* (* (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)))))
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d l) 0.5))
(t_1 (/ (* D M) (* d 2.0)))
(t_2 (pow t_1 2.0))
(t_3 (pow (- d) 0.5)))
(if (<= d -1.5325362465457807e-77)
(* (* (* t_3 (pow (/ -1.0 h) 0.5)) t_0) (- 1.0 (* h (* (/ 0.5 l) t_2))))
(let* ((t_4 (pow (/ d h) 0.5)))
(if (<= d -2.941112501210015e-305)
(*
(* t_4 (* t_3 (pow (/ -1.0 l) 0.5)))
(- 1.0 (* (* 0.5 t_2) (/ h l))))
(if (<= d 3.5292094803642007e+121)
(let* ((t_5 (* (fabs (* t_1 (sqrt (/ 0.5 l)))) (sqrt h))))
(* (* t_0 t_4) (- 1.0 (* t_5 t_5))))
(* d (sqrt (/ 1.0 (* h l))))))))))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 t_0 = pow((d / l), 0.5);
double t_1 = (D * M) / (d * 2.0);
double t_2 = pow(t_1, 2.0);
double t_3 = pow(-d, 0.5);
double tmp;
if (d <= -1.5325362465457807e-77) {
tmp = ((t_3 * pow((-1.0 / h), 0.5)) * t_0) * (1.0 - (h * ((0.5 / l) * t_2)));
} else {
double t_4 = pow((d / h), 0.5);
double tmp_1;
if (d <= -2.941112501210015e-305) {
tmp_1 = (t_4 * (t_3 * pow((-1.0 / l), 0.5))) * (1.0 - ((0.5 * t_2) * (h / l)));
} else if (d <= 3.5292094803642007e+121) {
double t_5 = fabs(t_1 * sqrt(0.5 / l)) * sqrt(h);
tmp_1 = (t_0 * t_4) * (1.0 - (t_5 * t_5));
} else {
tmp_1 = d * sqrt(1.0 / (h * l));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
Results
if d < -1.53253624654578069e-77Initial program 22.0
rmApplied clear-num_binary6422.0
Applied un-div-inv_binary6421.9
Applied associate-/r/_binary6420.2
Simplified20.2
Taylor expanded around -inf 15.5
Simplified11.1
if -1.53253624654578069e-77 < d < -2.941112501210015e-305Initial program 34.0
Taylor expanded around -inf 30.0
Simplified27.3
if -2.941112501210015e-305 < d < 3.5292094803642007e121Initial program 27.1
rmApplied clear-num_binary6427.1
Applied un-div-inv_binary6426.9
Applied associate-/r/_binary6425.6
Simplified25.6
rmApplied add-sqr-sqrt_binary6425.7
Applied add-sqr-sqrt_binary6425.8
Applied unswap-sqr_binary6425.8
Simplified25.7
Simplified21.4
if 3.5292094803642007e121 < d Initial program 27.9
Taylor expanded around inf 15.7
Simplified15.7
Final simplification18.2
herbie shell --seed 2021211
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (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)))))