\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}\;D \leq -1.7784595151432426 \cdot 10^{+134} \lor \neg \left(D \leq -5.029253008332105 \cdot 10^{-129} \lor \neg \left(D \leq 1.6799941372297761 \cdot 10^{-115}\right) \land D \leq 1.2136475211320043 \cdot 10^{-52}\right):\\
\;\;\;\;\log 1\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{{M}^{2} \cdot \left({D}^{2} \cdot h\right)}{{d}^{2}}\\
\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 (or (<= D -1.7784595151432426e+134)
(not
(or (<= D -5.029253008332105e-129)
(and (not (<= D 1.6799941372297761e-115))
(<= D 1.2136475211320043e-52)))))
(log 1.0)
(* 0.25 (/ (* (pow M 2.0) (* (pow D 2.0) h)) (pow d 2.0)))))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 ((D <= -1.7784595151432426e+134) || !((D <= -5.029253008332105e-129) || (!(D <= 1.6799941372297761e-115) && (D <= 1.2136475211320043e-52)))) {
tmp = log(1.0);
} else {
tmp = 0.25 * ((pow(M, 2.0) * (pow(D, 2.0) * h)) / pow(d, 2.0));
}
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 D < -1.77845951514324264e134 or -5.0292530083321051e-129 < D < 1.67999413722977612e-115 or 1.2136475211320043e-52 < D Initial program 61.0
Taylor expanded around -inf 42.4
Simplified42.7
rmApplied add-log-exp_binary64_114043.4
Simplified35.3
Taylor expanded around inf 30.8
if -1.77845951514324264e134 < D < -5.0292530083321051e-129 or 1.67999413722977612e-115 < D < 1.2136475211320043e-52Initial program 55.5
Taylor expanded around -inf 39.1
Simplified40.1
Taylor expanded around 0 32.0
Final simplification31.1
herbie shell --seed 2021016
(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))))))