\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 := 0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(\frac{D}{\sqrt[3]{d}} \cdot \frac{\left(M \cdot M\right) \cdot h}{d}\right)\right)\\
\mathbf{if}\;M \cdot M \leq 205532364386197380:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{D \cdot D}{d}\\
\mathbf{if}\;M \cdot M \leq 3.223267092491908 \cdot 10^{+241}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t_1\right) \cdot \frac{M \cdot M}{d}\right)\\
\mathbf{elif}\;M \cdot M \leq 2.594161242097384 \cdot 10^{+295}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_1 \cdot \frac{M \cdot \left(M \cdot h\right)}{d}\right)\\
\end{array}\\
\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
(*
0.25
(*
(/ D (* (cbrt d) (cbrt d)))
(* (/ D (cbrt d)) (/ (* (* M M) h) d))))))
(if (<= (* M M) 205532364386197380.0)
t_0
(let* ((t_1 (/ (* D D) d)))
(if (<= (* M M) 3.223267092491908e+241)
(* 0.25 (* (* h t_1) (/ (* M M) d)))
(if (<= (* M M) 2.594161242097384e+295)
t_0
(* 0.25 (* t_1 (/ (* 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 = 0.25 * ((D / (cbrt(d) * cbrt(d))) * ((D / cbrt(d)) * (((M * M) * h) / d)));
double tmp;
if ((M * M) <= 205532364386197380.0) {
tmp = t_0;
} else {
double t_1 = (D * D) / d;
double tmp_1;
if ((M * M) <= 3.223267092491908e+241) {
tmp_1 = 0.25 * ((h * t_1) * ((M * M) / d));
} else if ((M * M) <= 2.594161242097384e+295) {
tmp_1 = t_0;
} else {
tmp_1 = 0.25 * (t_1 * ((M * (M * h)) / d));
}
tmp = tmp_1;
}
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) < 205532364386197380 or 3.2232670924919083e241 < (*.f64 M M) < 2.5941612420973839e295Initial program 57.9
Taylor expanded in c0 around -inf 37.2
Taylor expanded in c0 around 0 30.1
Applied add-sqr-sqrt_binary6447.3
Applied unpow-prod-down_binary6447.3
Applied times-frac_binary6445.3
Simplified45.3
Simplified26.5
Applied add-cube-cbrt_binary6426.5
Applied times-frac_binary6422.9
Applied associate-*l*_binary6421.7
if 205532364386197380 < (*.f64 M M) < 3.2232670924919083e241Initial program 62.7
Taylor expanded in c0 around -inf 45.4
Taylor expanded in c0 around 0 34.7
Applied add-sqr-sqrt_binary6448.7
Applied unpow-prod-down_binary6448.7
Applied times-frac_binary6447.0
Simplified47.0
Simplified30.1
Applied *-un-lft-identity_binary6430.1
Applied times-frac_binary6427.2
Applied associate-*r*_binary6427.8
Simplified27.8
if 2.5941612420973839e295 < (*.f64 M M) Initial program 64.0
Taylor expanded in c0 around -inf 63.5
Taylor expanded in c0 around 0 63.3
Applied add-sqr-sqrt_binary6463.4
Applied unpow-prod-down_binary6463.4
Applied times-frac_binary6463.3
Simplified63.3
Simplified63.0
Applied associate-*r*_binary6449.3
Final simplification26.7
herbie shell --seed 2021307
(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))))))