\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.37686047095334 \cdot 10^{+133}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \left(D \cdot \left(D \cdot h\right)\right)\right)}{d \cdot d}\\
\mathbf{elif}\;M \leq -3.931039808045266 \cdot 10^{-166}:\\
\;\;\;\;\left(0.25 \cdot \frac{M \cdot M}{d}\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}\\
\mathbf{elif}\;M \leq -5.2181161000346884 \cdot 10^{-298}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \sqrt{-M \cdot M}\\
\mathbf{elif}\;M \leq 6.901359139380613 \cdot 10^{+123}:\\
\;\;\;\;0.25 \cdot \frac{\left(D \cdot h\right) \cdot \left(D \cdot \left(M \cdot M\right)\right)}{d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \left(D \cdot \left(D \cdot h\right)\right)\right)}{d \cdot d}\\
\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.37686047095334e+133)
(* 0.25 (/ (* M (* M (* D (* D h)))) (* d d)))
(if (<= M -3.931039808045266e-166)
(* (* 0.25 (/ (* M M) d)) (/ (* D (* D h)) d))
(if (<= M -5.2181161000346884e-298)
(* (/ c0 (* 2.0 w)) (sqrt (- (* M M))))
(if (<= M 6.901359139380613e+123)
(* 0.25 (/ (* (* D h) (* D (* M M))) (* d d)))
(* 0.25 (/ (* M (* M (* D (* D h)))) (* d d))))))))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.37686047095334e+133) {
tmp = 0.25 * ((M * (M * (D * (D * h)))) / (d * d));
} else if (M <= -3.931039808045266e-166) {
tmp = (0.25 * ((M * M) / d)) * ((D * (D * h)) / d);
} else if (M <= -5.2181161000346884e-298) {
tmp = (c0 / (2.0 * w)) * sqrt(-(M * M));
} else if (M <= 6.901359139380613e+123) {
tmp = 0.25 * (((D * h) * (D * (M * M))) / (d * d));
} else {
tmp = 0.25 * ((M * (M * (D * (D * h)))) / (d * d));
}
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.37686047095334e133 or 6.90135913938061331e123 < M Initial program 63.9
Taylor expanded around -inf 60.3
Simplified60.5
Taylor expanded around 0 59.5
Simplified59.5
rmApplied associate-*l*_binary64_104258.9
rmApplied associate-*l*_binary64_104243.1
if -1.37686047095334e133 < M < -3.93103980804526629e-166Initial program 60.9
Taylor expanded around -inf 38.3
Simplified39.1
Taylor expanded around 0 30.3
Simplified30.3
rmApplied associate-*l*_binary64_104228.4
rmApplied times-frac_binary64_110724.4
Applied associate-*r*_binary64_104124.4
if -3.93103980804526629e-166 < M < -5.2181161000346884e-298Initial program 55.5
Taylor expanded around 0 28.3
Simplified28.3
if -5.2181161000346884e-298 < M < 6.90135913938061331e123Initial program 58.4
Taylor expanded around -inf 37.8
Simplified38.6
Taylor expanded around 0 31.0
Simplified31.0
rmApplied associate-*l*_binary64_104228.9
rmApplied associate-*r*_binary64_104127.4
Final simplification29.4
herbie shell --seed 2021013
(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))))))