\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 -4.837877690709628 \cdot 10^{+111}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \frac{\left(D \cdot D\right) \cdot h}{d}\right)}{d}\\
\mathbf{elif}\;M \leq -7.670814269380083 \cdot 10^{-225}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot M\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}}{d}\\
\mathbf{elif}\;M \leq 4.8789530201336614 \cdot 10^{-253}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(D \cdot D\right) \cdot \left(M \cdot M\right)\right) \cdot \frac{h}{d}}{d}\\
\mathbf{elif}\;M \leq 8.527469105065078 \cdot 10^{+35}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot M\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \frac{\left(D \cdot D\right) \cdot h}{d}\right)}{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 -4.837877690709628e+111)
(* 0.25 (/ (* M (* M (/ (* (* D D) h) d))) d))
(if (<= M -7.670814269380083e-225)
(* 0.25 (/ (* (* M M) (/ (* D (* D h)) d)) d))
(if (<= M 4.8789530201336614e-253)
(* 0.25 (/ (* (* (* D D) (* M M)) (/ h d)) d))
(if (<= M 8.527469105065078e+35)
(* 0.25 (/ (* (* M M) (/ (* D (* D h)) 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 <= -4.837877690709628e+111) {
tmp = 0.25 * ((M * (M * (((D * D) * h) / d))) / d);
} else if (M <= -7.670814269380083e-225) {
tmp = 0.25 * (((M * M) * ((D * (D * h)) / d)) / d);
} else if (M <= 4.8789530201336614e-253) {
tmp = 0.25 * ((((D * D) * (M * M)) * (h / d)) / d);
} else if (M <= 8.527469105065078e+35) {
tmp = 0.25 * (((M * M) * ((D * (D * h)) / 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 < -4.837877690709628e111 or 8.52746910506507779e35 < M Initial program 63.6
Taylor expanded around -inf 53.9
Simplified54.3
Taylor expanded around 0 51.5
Simplified51.5
rmApplied associate-/r*_binary64_138650.2
Simplified49.4
rmApplied associate-*l*_binary64_138336.7
if -4.837877690709628e111 < M < -7.67081426938008302e-225 or 4.8789530201336614e-253 < M < 8.52746910506507779e35Initial program 59.3
Taylor expanded around -inf 37.4
Simplified38.3
Taylor expanded around 0 30.1
Simplified30.1
rmApplied associate-/r*_binary64_138627.6
Simplified27.1
rmApplied associate-*l*_binary64_138324.1
if -7.67081426938008302e-225 < M < 4.8789530201336614e-253Initial program 55.7
Taylor expanded around -inf 37.8
Simplified38.6
Taylor expanded around 0 32.2
Simplified32.2
rmApplied associate-/r*_binary64_138627.9
Simplified27.9
rmApplied *-un-lft-identity_binary64_144227.9
Applied times-frac_binary64_144827.6
Applied associate-*r*_binary64_138227.5
Final simplification27.6
herbie shell --seed 2021096
(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))))))