\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}
t_0 := \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\\
\mathbf{if}\;M \cdot M \leq 8.501049133625495 \cdot 10^{+307}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\left(\frac{D}{d} \cdot h\right) \cdot \frac{M \cdot M}{\sqrt[3]{d}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\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
(let* ((t_0 (/ D (* (cbrt d) (cbrt d)))))
(if (<= (* M M) 8.501049133625495e+307)
(* 0.25 (* t_0 (* (* (/ D d) h) (/ (* M M) (cbrt d)))))
(* 0.25 (* t_0 (* (/ D (cbrt d)) (/ (* M (* M h)) 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 t_0 = D / (cbrt(d) * cbrt(d));
double tmp;
if ((M * M) <= 8.501049133625495e+307) {
tmp = 0.25 * (t_0 * (((D / d) * h) * ((M * M) / cbrt(d))));
} else {
tmp = 0.25 * (t_0 * ((D / cbrt(d)) * ((M * (M * h)) / 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) < 8.5010491336254954e307Initial program 59.0
Taylor expanded in c0 around -inf 31.1
Applied add-sqr-sqrt_binary6447.8
Applied unpow-prod-down_binary6447.8
Applied times-frac_binary6445.9
Simplified45.9
Simplified27.4
Applied add-cube-cbrt_binary6427.4
Applied times-frac_binary6424.3
Applied associate-*l*_binary6422.4
Applied add-cube-cbrt_binary6422.5
Applied times-frac_binary6421.6
Applied associate-*r*_binary6420.6
Simplified19.7
if 8.5010491336254954e307 < (*.f64 M M) Initial program 64.0
Taylor expanded in c0 around -inf 64.0
Applied add-sqr-sqrt_binary6464.0
Applied unpow-prod-down_binary6464.0
Applied times-frac_binary6463.9
Simplified63.9
Simplified63.9
Applied add-cube-cbrt_binary6463.9
Applied times-frac_binary6463.9
Applied associate-*l*_binary6463.9
Applied associate-*r*_binary6445.0
Final simplification23.3
herbie shell --seed 2022095
(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))))))