\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}
t_0 := \frac{c0}{D \cdot \left(w \cdot h\right)}\\
t_1 := d \cdot t_0\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq -8.582941301532108 \cdot 10^{-100}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \frac{d}{\frac{D}{t_1}}\right)\\
\mathbf{elif}\;M \leq -9.983596553371605 \cdot 10^{-128}:\\
\;\;\;\;t_2 \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left(h \cdot {M}^{2}\right)\right)}{c0 \cdot {d}^{2}}\right)\\
\mathbf{elif}\;M \leq -4.163638784959454 \cdot 10^{-173}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \left(t_1 \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;M \leq 5.141186143210871 \cdot 10^{-291}:\\
\;\;\;\;t_2 \cdot \sqrt{-{M}^{2}}\\
\mathbf{elif}\;M \leq 1.4373941293337057 \cdot 10^{-256}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \frac{d}{\frac{\frac{D}{t_0}}{d}}\right)\\
\mathbf{elif}\;M \leq 4.474319272115561 \cdot 10^{-228}:\\
\;\;\;\;\log \left({\left(e^{\frac{c0}{w}}\right)}^{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \left(\left(d \cdot \frac{\sqrt[3]{c0} \cdot \sqrt[3]{c0}}{D}\right) \cdot \frac{d}{\frac{D}{\frac{\sqrt[3]{c0}}{w \cdot h}}}\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
(let* ((t_0 (/ c0 (* D (* w h)))) (t_1 (* d t_0)) (t_2 (/ c0 (* 2.0 w))))
(if (<= M -8.582941301532108e-100)
(* t_2 (* 2.0 (/ d (/ D t_1))))
(if (<= M -9.983596553371605e-128)
(*
t_2
(* 0.5 (/ (* (pow D 2.0) (* w (* h (pow M 2.0)))) (* c0 (pow d 2.0)))))
(if (<= M -4.163638784959454e-173)
(* t_2 (* 2.0 (* t_1 (/ d D))))
(if (<= M 5.141186143210871e-291)
(* t_2 (sqrt (- (pow M 2.0))))
(if (<= M 1.4373941293337057e-256)
(* t_2 (* 2.0 (/ d (/ (/ D t_0) d))))
(if (<= M 4.474319272115561e-228)
(log
(pow (exp (/ c0 w)) (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(*
t_2
(*
2.0
(*
(* d (/ (* (cbrt c0) (cbrt c0)) D))
(/ d (/ D (/ (cbrt c0) (* w h)))))))))))))))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 t_0 = c0 / (D * (w * h));
double t_1 = d * t_0;
double t_2 = c0 / (2.0 * w);
double tmp;
if (M <= -8.582941301532108e-100) {
tmp = t_2 * (2.0 * (d / (D / t_1)));
} else if (M <= -9.983596553371605e-128) {
tmp = t_2 * (0.5 * ((pow(D, 2.0) * (w * (h * pow(M, 2.0)))) / (c0 * pow(d, 2.0))));
} else if (M <= -4.163638784959454e-173) {
tmp = t_2 * (2.0 * (t_1 * (d / D)));
} else if (M <= 5.141186143210871e-291) {
tmp = t_2 * sqrt(-pow(M, 2.0));
} else if (M <= 1.4373941293337057e-256) {
tmp = t_2 * (2.0 * (d / ((D / t_0) / d)));
} else if (M <= 4.474319272115561e-228) {
tmp = log(pow(exp(c0 / w), ((c0 * (d * d)) / ((w * h) * (D * D)))));
} else {
tmp = t_2 * (2.0 * ((d * ((cbrt(c0) * cbrt(c0)) / D)) * (d / (D / (cbrt(c0) / (w * h))))));
}
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 < -8.5829413015321076e-100Initial program 50.5
Taylor expanded in c0 around inf 42.0
Applied unpow2_binary6442.0
Applied associate-*l*_binary6440.1
Applied associate-/l*_binary6439.6
Simplified39.0
Applied sqr-pow_binary6439.0
Applied associate-/l*_binary6434.5
Simplified33.8
if -8.5829413015321076e-100 < M < -9.9835965533716054e-128Initial program 45.9
Taylor expanded in c0 around -inf 44.0
if -9.9835965533716054e-128 < M < -4.163638784959454e-173Initial program 47.5
Taylor expanded in c0 around inf 47.2
Applied unpow2_binary6447.2
Applied associate-*l*_binary6444.2
Applied associate-/l*_binary6443.9
Simplified43.0
Applied *-un-lft-identity_binary6443.0
Applied times-frac_binary6442.8
Applied *-un-lft-identity_binary6442.8
Applied times-frac_binary6442.8
Applied add-sqr-sqrt_binary6453.2
Applied unpow-prod-down_binary6453.2
Applied times-frac_binary6451.8
Simplified51.8
Simplified39.6
if -4.163638784959454e-173 < M < 5.14118614321087072e-291Initial program 43.6
Taylor expanded in c0 around 0 37.5
if 5.14118614321087072e-291 < M < 1.4373941293337057e-256Initial program 45.8
Taylor expanded in c0 around inf 45.6
Applied unpow2_binary6445.6
Applied associate-*l*_binary6442.9
Applied associate-/l*_binary6442.1
Simplified39.8
Applied unpow2_binary6439.8
Applied associate-/l*_binary6433.4
if 1.4373941293337057e-256 < M < 4.47431927211556072e-228Initial program 46.9
Taylor expanded in c0 around inf 47.2
Applied unpow2_binary6447.2
Applied associate-*l*_binary6442.1
Applied associate-/l*_binary6442.0
Simplified40.7
Applied add-log-exp_binary6444.3
Simplified39.3
if 4.47431927211556072e-228 < M Initial program 49.2
Taylor expanded in c0 around inf 43.2
Applied unpow2_binary6443.2
Applied associate-*l*_binary6440.8
Applied associate-/l*_binary6440.5
Simplified39.4
Applied add-cube-cbrt_binary6439.5
Applied times-frac_binary6439.4
Applied *-un-lft-identity_binary6439.4
Applied times-frac_binary6439.4
Applied add-sqr-sqrt_binary6451.6
Applied unpow-prod-down_binary6451.6
Applied times-frac_binary6449.1
Simplified49.1
Simplified34.4
Final simplification35.4
herbie shell --seed 2022068
(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))))))