\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 \cdot M \leq 3.4289290228646055 \cdot 10^{-148} \lor \neg \left(M \cdot M \leq 2.5703314000261793 \cdot 10^{+257}\right):\\
\;\;\;\;\log \left({1}^{\left(\frac{1}{c0 \cdot \left(d \cdot d\right)}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot M\right) \cdot \left(\left(D \cdot D\right) \cdot h\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 (or (<= (* M M) 3.4289290228646055e-148)
(not (<= (* M M) 2.5703314000261793e+257)))
(log (pow 1.0 (/ 1.0 (* c0 (* 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 * M) <= 3.4289290228646055e-148) || !((M * M) <= 2.5703314000261793e+257)) {
tmp = log(pow(1.0, (1.0 / (c0 * (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 (*.f64 M M) < 3.42892902286460549e-148 or 2.57033140002617931e257 < (*.f64 M M) Initial program 58.2
Taylor expanded around -inf 43.5
Simplified44.3
rmApplied add-log-exp_binary6444.6
Simplified35.7
rmApplied div-inv_binary6435.7
Applied pow-unpow_binary6430.9
Simplified30.9
Taylor expanded around 0 30.3
if 3.42892902286460549e-148 < (*.f64 M M) < 2.57033140002617931e257Initial program 61.8
Taylor expanded around -inf 38.6
Simplified38.8
Taylor expanded around 0 30.9
Simplified30.9
Final simplification30.5
herbie shell --seed 2021139
(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))))))