\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 -1.93057971646278 \cdot 10^{+160}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot \left(M \cdot h\right)\right) \cdot \frac{D \cdot D}{d}}{d}\\
\mathbf{elif}\;M \leq 5.084131809070544 \cdot 10^{+126}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{D}{\sqrt[3]{d}}}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot e^{\left(\log \left({D}^{2}\right) + \left(2 \cdot \log M + \log h\right)\right) - \log \left({d}^{2}\right)}\\
\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 -1.93057971646278e+160)
(* 0.25 (/ (* (* M (* M h)) (/ (* D D) d)) d))
(if (<= M 5.084131809070544e+126)
(*
0.25
(/ (* (* (* h (* M M)) (/ D (* (cbrt d) (cbrt d)))) (/ D (cbrt d))) d))
(*
0.25
(exp
(-
(+ (log (pow D 2.0)) (+ (* 2.0 (log M)) (log h)))
(log (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 <= -1.93057971646278e+160) {
tmp = 0.25 * (((M * (M * h)) * ((D * D) / d)) / d);
} else if (M <= 5.084131809070544e+126) {
tmp = 0.25 * ((((h * (M * M)) * (D / (cbrt(d) * cbrt(d)))) * (D / cbrt(d))) / d);
} else {
tmp = 0.25 * exp((log(pow(D, 2.0)) + ((2.0 * log(M)) + log(h))) - log(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 M < -1.9305797164627801e160Initial program 64.0
Taylor expanded in c0 around -inf 64.0
Taylor expanded in c0 around 0 64.0
Applied unpow2_binary6464.0
Applied associate-/r*_binary6464.0
Simplified64.0
Applied associate-*r*_binary6449.6
if -1.9305797164627801e160 < M < 5.084131809070544e126Initial program 58.8
Taylor expanded in c0 around -inf 38.7
Taylor expanded in c0 around 0 31.3
Applied unpow2_binary6431.3
Applied associate-/r*_binary6428.3
Simplified27.9
Applied add-cube-cbrt_binary6427.9
Applied times-frac_binary6424.5
Applied associate-*r*_binary6422.9
if 5.084131809070544e126 < M Initial program 63.9
Taylor expanded in c0 around -inf 62.4
Taylor expanded in c0 around 0 60.5
Applied add-exp-log_binary6460.6
Applied add-exp-log_binary6461.9
Applied pow-to-exp_binary6461.9
Applied prod-exp_binary6457.1
Applied add-exp-log_binary6457.1
Applied prod-exp_binary6452.3
Applied div-exp_binary6450.9
Final simplification27.0
herbie shell --seed 2022061
(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))))))