\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 -2.792856815890184 \cdot 10^{+131}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \left(\left(D \cdot D\right) \cdot h\right)\right)}{d \cdot d}\\
\mathbf{elif}\;M \leq -5.0466503514205154 \cdot 10^{-176}:\\
\;\;\;\;0.25 \cdot \frac{\frac{M \cdot M}{d} \cdot \left(D \cdot \left(D \cdot h\right)\right)}{d}\\
\mathbf{elif}\;M \leq -4.892077319176114 \cdot 10^{-253}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(\left(\left(D \cdot D\right) \cdot h\right) \cdot \frac{M}{d}\right)}{d}\\
\mathbf{elif}\;M \leq 2.93864576183954 \cdot 10^{-163}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \sqrt{-{M}^{2}}\\
\mathbf{elif}\;M \leq 5.756608776233024 \cdot 10^{+116}:\\
\;\;\;\;0.25 \cdot \frac{\frac{M \cdot M}{d} \cdot \left(D \cdot \left(D \cdot h\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(\left(\left(D \cdot D\right) \cdot h\right) \cdot \frac{M}{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 -2.792856815890184e+131)
(* 0.25 (/ (* M (* M (* (* D D) h))) (* d d)))
(if (<= M -5.0466503514205154e-176)
(* 0.25 (/ (* (/ (* M M) d) (* D (* D h))) d))
(if (<= M -4.892077319176114e-253)
(* 0.25 (/ (* M (* (* (* D D) h) (/ M d))) d))
(if (<= M 2.93864576183954e-163)
(* (/ c0 (* 2.0 w)) (sqrt (- (pow M 2.0))))
(if (<= M 5.756608776233024e+116)
(* 0.25 (/ (* (/ (* M M) d) (* D (* D h))) d))
(* 0.25 (/ (* M (* (* (* D D) h) (/ M 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 <= -2.792856815890184e+131) {
tmp = 0.25 * ((M * (M * ((D * D) * h))) / (d * d));
} else if (M <= -5.0466503514205154e-176) {
tmp = 0.25 * ((((M * M) / d) * (D * (D * h))) / d);
} else if (M <= -4.892077319176114e-253) {
tmp = 0.25 * ((M * (((D * D) * h) * (M / d))) / d);
} else if (M <= 2.93864576183954e-163) {
tmp = (c0 / (2.0 * w)) * sqrt(-pow(M, 2.0));
} else if (M <= 5.756608776233024e+116) {
tmp = 0.25 * ((((M * M) / d) * (D * (D * h))) / d);
} else {
tmp = 0.25 * ((M * (((D * D) * h) * (M / 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 < -2.79285681589018382e131Initial program 63.9
Taylor expanded around -inf 60.6
Simplified60.5
Taylor expanded around 0 59.5
Simplified59.5
rmApplied associate-*l*_binary6444.8
if -2.79285681589018382e131 < M < -5.0466503514205154e-176 or 2.93864576183954e-163 < M < 5.756608776233024e116Initial program 60.6
Taylor expanded around -inf 37.5
Simplified37.9
Taylor expanded around 0 30.5
Simplified30.5
rmApplied associate-/r*_binary6428.0
Simplified27.1
rmApplied associate-*l*_binary6423.8
if -5.0466503514205154e-176 < M < -4.8920773191761141e-253 or 5.756608776233024e116 < M Initial program 61.1
Taylor expanded around -inf 47.9
Simplified48.4
Taylor expanded around 0 43.8
Simplified43.8
rmApplied associate-/r*_binary6441.5
Simplified41.2
rmApplied *-un-lft-identity_binary6441.2
Applied times-frac_binary6433.4
Applied associate-*l*_binary6430.0
Simplified30.0
if -4.8920773191761141e-253 < M < 2.93864576183954e-163Initial program 55.9
Taylor expanded around 0 28.0
Final simplification27.6
herbie shell --seed 2021166
(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))))))