\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{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
t_3 := t_0 \cdot \left(2 \cdot \frac{c0 \cdot {d}^{2}}{\left(w \cdot h\right) \cdot {D}^{2}}\right)\\
\mathbf{if}\;t_2 \leq -9.237904377630584 \cdot 10^{-150}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \frac{h \cdot \left(M \cdot M\right)}{d}\\
\mathbf{if}\;t_2 \leq 0:\\
\;\;\;\;0.25 \cdot \left(D \cdot \left(\frac{D}{d} \cdot t_4\right)\right)\\
\mathbf{elif}\;t_2 \leq 8.045466502335897 \cdot 10^{+204}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}} \cdot \left(t_4 \cdot \frac{D}{\sqrt[3]{d}}\right)\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 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))))
(t_3 (* t_0 (* 2.0 (/ (* c0 (pow d 2.0)) (* (* w h) (pow D 2.0)))))))
(if (<= t_2 -9.237904377630584e-150)
t_3
(let* ((t_4 (/ (* h (* M M)) d)))
(if (<= t_2 0.0)
(* 0.25 (* D (* (/ D d) t_4)))
(if (<= t_2 8.045466502335897e+204)
t_3
(*
0.25
(* (/ D (* (cbrt d) (cbrt d))) (* t_4 (/ D (cbrt 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 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + sqrt((t_1 * t_1) - (M * M)));
double t_3 = t_0 * (2.0 * ((c0 * pow(d, 2.0)) / ((w * h) * pow(D, 2.0))));
double tmp;
if (t_2 <= -9.237904377630584e-150) {
tmp = t_3;
} else {
double t_4 = (h * (M * M)) / d;
double tmp_1;
if (t_2 <= 0.0) {
tmp_1 = 0.25 * (D * ((D / d) * t_4));
} else if (t_2 <= 8.045466502335897e+204) {
tmp_1 = t_3;
} else {
tmp_1 = 0.25 * ((D / (cbrt(d) * cbrt(d))) * (t_4 * (D / cbrt(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 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -9.23790437763058447e-150 or 0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 8.0454665023358966e204Initial program 39.9
Taylor expanded in c0 around inf 34.1
if -9.23790437763058447e-150 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 0.0Initial program 28.3
Taylor expanded in c0 around -inf 26.6
Taylor expanded in c0 around 0 25.4
Applied add-sqr-sqrt_binary6444.9
Applied unpow-prod-down_binary6444.9
Applied times-frac_binary6443.4
Simplified43.4
Simplified22.8
Applied *-un-lft-identity_binary6422.8
Applied times-frac_binary6421.7
Applied associate-*l*_binary6420.4
if 8.0454665023358966e204 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 63.8
Taylor expanded in c0 around -inf 41.7
Taylor expanded in c0 around 0 34.6
Applied add-sqr-sqrt_binary6449.4
Applied unpow-prod-down_binary6449.4
Applied times-frac_binary6447.6
Simplified47.6
Simplified31.0
Applied add-cube-cbrt_binary6431.0
Applied times-frac_binary6427.8
Applied associate-*l*_binary6426.3
Final simplification26.5
herbie shell --seed 2022125
(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))))))