\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}
\mathbf{if}\;M \leq -1.9909816659836515 \cdot 10^{+146}:\\
\;\;\;\;0.25 \cdot \frac{\left(D \cdot D\right) \cdot \frac{M \cdot \left(M \cdot h\right)}{d}}{d}\\
\mathbf{elif}\;M \leq -6.128504964236849 \cdot 10^{+32}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{h}{\sqrt[3]{d}}}{d}\\
\mathbf{elif}\;M \leq 9.128356389280072 \cdot 10^{+144}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(D \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{\sqrt{d}} \cdot \frac{M}{\frac{{d}^{1.5}}{M \cdot h}}\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
(if (<= M -1.9909816659836515e+146)
(* 0.25 (/ (* (* D D) (/ (* M (* M h)) d)) d))
(if (<= M -6.128504964236849e+32)
(*
0.25
(/ (* (* (* D D) (/ (* M M) (* (cbrt d) (cbrt d)))) (/ h (cbrt d))) d))
(if (<= M 9.128356389280072e+144)
(* 0.25 (/ (* D (* D (/ (* h (* M M)) d))) d))
(* 0.25 (* (/ (* D D) (sqrt d)) (/ M (/ (pow d 1.5) (* M 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 tmp;
if (M <= -1.9909816659836515e+146) {
tmp = 0.25 * (((D * D) * ((M * (M * h)) / d)) / d);
} else if (M <= -6.128504964236849e+32) {
tmp = 0.25 * ((((D * D) * ((M * M) / (cbrt(d) * cbrt(d)))) * (h / cbrt(d))) / d);
} else if (M <= 9.128356389280072e+144) {
tmp = 0.25 * ((D * (D * ((h * (M * M)) / d))) / d);
} else {
tmp = 0.25 * (((D * D) / sqrt(d)) * (M / (pow(d, 1.5) / (M * 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 < -1.99098166598365152e146Initial program 64.0
Taylor expanded around -inf 63.6
Simplified63.7
Taylor expanded around 0 63.1
Simplified63.1
rmApplied associate-/r*_binary6462.9
Simplified62.9
rmApplied associate-*l*_binary6445.9
if -1.99098166598365152e146 < M < -6.1285049642368493e32Initial program 62.6
Taylor expanded around -inf 48.2
Simplified47.7
Taylor expanded around 0 38.0
Simplified38.0
rmApplied associate-/r*_binary6435.7
Simplified33.9
rmApplied add-cube-cbrt_binary6434.1
Applied times-frac_binary6429.1
Applied associate-*r*_binary6428.9
if -6.1285049642368493e32 < M < 9.1283563892800718e144Initial program 58.4
Taylor expanded around -inf 37.6
Simplified39.8
Taylor expanded around 0 30.2
Simplified30.2
rmApplied associate-/r*_binary6427.0
Simplified26.5
rmApplied associate-*l*_binary6422.8
if 9.1283563892800718e144 < M Initial program 64.0
Taylor expanded around -inf 62.9
Simplified63.1
Taylor expanded around 0 62.3
Simplified62.3
rmApplied associate-/r*_binary6462.3
Simplified62.1
rmApplied add-sqr-sqrt_binary6463.1
Applied times-frac_binary6463.1
Simplified52.0
Final simplification27.1
herbie shell --seed 2021196
(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))))))