\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{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_1 := \frac{\sqrt[3]{d}}{\sqrt[3]{h}}\\
t_2 := \sqrt{t_1}\\
t_3 := \sqrt[3]{\ell} \cdot \sqrt[3]{\ell}\\
t_4 := \sqrt{\frac{d}{\sqrt[3]{\ell}}}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_0\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(t_0, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \left(t_4 \cdot \left(t_2 \cdot \left|\sqrt[3]{d}\right|\right)\right)}{\left|\sqrt[3]{h}\right| \cdot \sqrt{t_3}}\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 \cdot \left|t_1\right|\right) \cdot \left(t_4 \cdot \sqrt{\frac{1}{t_3}}\right)\\
\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 (/ (* M D) (* d 2.0)) 2.0))
(t_1 (/ (cbrt d) (cbrt h)))
(t_2 (sqrt t_1))
(t_3 (* (cbrt l) (cbrt l)))
(t_4 (sqrt (/ d (cbrt l)))))
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_0) (/ h l))))
INFINITY)
(/
(* (fma t_0 (* (/ h l) -0.5) 1.0) (* t_4 (* t_2 (fabs (cbrt d)))))
(* (fabs (cbrt h)) (sqrt t_3)))
(* (* t_2 (fabs t_1)) (* t_4 (sqrt (/ 1.0 t_3)))))))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(((M * D) / (d * 2.0)), 2.0);
double t_1 = cbrt(d) / cbrt(h);
double t_2 = sqrt(t_1);
double t_3 = cbrt(l) * cbrt(l);
double t_4 = sqrt(d / cbrt(l));
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_0) * (h / l)))) <= ((double) INFINITY)) {
tmp = (fma(t_0, ((h / l) * -0.5), 1.0) * (t_4 * (t_2 * fabs(cbrt(d))))) / (fabs(cbrt(h)) * sqrt(t_3));
} else {
tmp = (t_2 * fabs(t_1)) * (t_4 * sqrt(1.0 / t_3));
}
return tmp;
}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 19.5
Simplified19.5
Applied add-cube-cbrt_binary6412.9
Applied *-un-lft-identity_binary6412.9
Applied times-frac_binary6412.9
Applied sqrt-prod_binary648.2
Applied sqrt-div_binary648.2
Applied associate-*l/_binary648.2
Applied fabs-div_binary648.2
Applied associate-*l/_binary648.2
Applied frac-times_binary648.2
Applied associate-*l/_binary647.9
Simplified7.9
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 64.0
Simplified64.0
Taylor expanded around 0 43.5
Final simplification13.5
herbie shell --seed 2021210
(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)))))