\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.153227891404315 \cdot 10^{+162}:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{d}{\frac{M \cdot \left(M \cdot h\right)}{d}}}\\
\mathbf{elif}\;M \leq 3.542576998845787 \cdot 10^{+151}:\\
\;\;\;\;0.25 \cdot \left(\frac{D}{\frac{d}{h \cdot \left(M \cdot M\right)}} \cdot \frac{D}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{e^{\mathsf{fma}\left(2, \log \left(M \cdot D\right), \log 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 (<= M -6.153227891404315e+162)
(* 0.25 (/ (pow D 2.0) (/ d (/ (* M (* M h)) d))))
(if (<= M 3.542576998845787e+151)
(* 0.25 (* (/ D (/ d (* h (* M M)))) (/ D d)))
(* 0.25 (/ (exp (fma 2.0 (log (* M D)) (log 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 (M <= -6.153227891404315e+162) {
tmp = 0.25 * (pow(D, 2.0) / (d / ((M * (M * h)) / d)));
} else if (M <= 3.542576998845787e+151) {
tmp = 0.25 * ((D / (d / (h * (M * M)))) * (D / d));
} else {
tmp = 0.25 * (exp(fma(2.0, log(M * D), log(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
if M < -6.15322789140431471e162Initial program 64.0
Taylor expanded in c0 around -inf 64.0
Taylor expanded in c0 around 0 64.0
Applied associate-/l*_binary6464.0
Simplified64.0
Applied associate-*r*_binary6451.8
if -6.15322789140431471e162 < M < 3.5425769988457872e151Initial program 58.9
Taylor expanded in c0 around -inf 38.8
Taylor expanded in c0 around 0 31.0
Applied associate-/l*_binary6430.8
Simplified27.8
Applied associate-/r/_binary6427.8
Applied unpow2_binary6427.8
Applied times-frac_binary6421.9
if 3.5425769988457872e151 < M Initial program 64.0
Taylor expanded in c0 around -inf 63.5
Taylor expanded in c0 around 0 63.5
Applied add-exp-log_binary6463.8
Applied pow-to-exp_binary6463.8
Applied prod-exp_binary6457.7
Applied pow-to-exp_binary6460.6
Applied prod-exp_binary6454.8
Simplified54.7
Final simplification26.1
herbie shell --seed 2022082
(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))))))