\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 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{d}\right)}{d}\\
\mathbf{elif}\;t_1 \leq 6.00593518153366 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{D}{\sqrt[3]{d}}}{d}\\
\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 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 (- INFINITY))
(* 0.25 (/ (* h (* (* M M) (/ (* D D) d))) d))
(if (<= t_1 6.00593518153366e+76)
t_1
(*
0.25
(/
(* (* (* M (* h M)) (/ D (* (cbrt d) (cbrt d)))) (/ D (cbrt d)))
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 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt((t_0 * t_0) - (M * M)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = 0.25 * ((h * ((M * M) * ((D * D) / d))) / d);
} else if (t_1 <= 6.00593518153366e+76) {
tmp = t_1;
} else {
tmp = 0.25 * ((((M * (h * M)) * (D / (cbrt(d) * cbrt(d)))) * (D / cbrt(d))) / 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 (/.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))))) < -inf.0Initial program 64.0
Taylor expanded in c0 around -inf 50.4
Applied unpow2_binary6450.4
Applied associate-/r*_binary6450.3
Simplified50.4
Applied associate-*l*_binary6450.8
if -inf.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))))) < 6.00593518153366e76Initial program 23.7
if 6.00593518153366e76 < (*.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.6
Taylor expanded in c0 around -inf 35.4
Applied unpow2_binary6435.4
Applied associate-/r*_binary6432.5
Simplified31.9
Applied associate-*r*_binary6429.5
Applied add-cube-cbrt_binary6429.5
Applied times-frac_binary6425.9
Applied associate-*r*_binary6423.9
Final simplification25.0
herbie shell --seed 2022067
(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))))))