\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 -6.359698016561584 \cdot 10^{+130}:\\
\;\;\;\;0.25 \cdot \frac{\left(D \cdot D\right) \cdot \frac{M \cdot \left(M \cdot h\right)}{d}}{d}\\
\mathbf{elif}\;M \leq 4.1923584058765576 \cdot 10^{+125}:\\
\;\;\;\;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 \frac{e^{2 \cdot \log \left(M \cdot D\right) + \log \left(\frac{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 -6.359698016561584e+130)
(* 0.25 (/ (* (* D D) (/ (* M (* M h)) d)) d))
(if (<= M 4.1923584058765576e+125)
(* 0.25 (/ (* D (* D (/ (* h (* M M)) d))) d))
(* 0.25 (/ (exp (+ (* 2.0 (log (* M D))) (log (/ 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 <= -6.359698016561584e+130) {
tmp = 0.25 * (((D * D) * ((M * (M * h)) / d)) / d);
} else if (M <= 4.1923584058765576e+125) {
tmp = 0.25 * ((D * (D * ((h * (M * M)) / d))) / d);
} else {
tmp = 0.25 * (exp((2.0 * log(M * D)) + log(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 < -6.35969801656158433e130Initial program 64.0
Taylor expanded around -inf 61.6
Simplified61.6
Taylor expanded around 0 61.1
Simplified61.1
rmApplied associate-/r*_binary6460.5
Simplified60.5
rmApplied associate-*r*_binary6447.2
if -6.35969801656158433e130 < M < 4.19235840587655755e125Initial program 58.6
Taylor expanded around -inf 38.4
Simplified40.6
Taylor expanded around 0 30.8
Simplified30.8
rmApplied associate-/r*_binary6427.8
Simplified27.3
rmApplied associate-*l*_binary6423.0
if 4.19235840587655755e125 < M Initial program 64.0
Taylor expanded around -inf 60.9
Simplified60.9
Taylor expanded around 0 59.2
Simplified59.2
rmApplied associate-/r*_binary6458.7
Simplified58.4
rmApplied add-exp-log_binary6460.8
Applied add-exp-log_binary6460.8
Applied add-exp-log_binary6460.8
Applied prod-exp_binary6460.8
Applied add-exp-log_binary6462.9
Applied prod-exp_binary6459.1
Applied div-exp_binary6457.4
Applied add-exp-log_binary6461.6
Applied add-exp-log_binary6461.6
Applied prod-exp_binary6461.6
Applied prod-exp_binary6459.9
Simplified53.6
Final simplification27.6
herbie shell --seed 2021202
(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))))))