\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 \frac{M \cdot \left(M \cdot \frac{\left(D \cdot D\right) \cdot h}{d}\right)}{d}\\
\mathbf{if}\;M \leq -4.875423653967228 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \leq -3.1905588265615016 \cdot 10^{-137}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(M \cdot M\right) \cdot \frac{D \cdot D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{h}{\sqrt[3]{d}}}{d}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := 0.25 \cdot \frac{\left(M \cdot M\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}}{d}\\
\mathbf{if}\;M \leq -9.169952495142169 \cdot 10^{-295}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 7.259802738012728 \cdot 10^{-177}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \sqrt{-M \cdot M}\\
\mathbf{elif}\;M \leq 5.5286507786806465 \cdot 10^{+119}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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 (/ (* M (* M (/ (* (* D D) h) d))) d))))
(if (<= M -4.875423653967228e+48)
t_0
(if (<= M -3.1905588265615016e-137)
(*
0.25
(/ (* (* (* M M) (/ (* D D) (* (cbrt d) (cbrt d)))) (/ h (cbrt d))) d))
(let* ((t_1 (* 0.25 (/ (* (* M M) (/ (* D (* D h)) d)) d))))
(if (<= M -9.169952495142169e-295)
t_1
(if (<= M 7.259802738012728e-177)
(* (/ c0 (* 2.0 w)) (sqrt (- (* M M))))
(if (<= M 5.5286507786806465e+119) t_1 t_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 t_0 = 0.25 * ((M * (M * (((D * D) * h) / d))) / d);
double tmp;
if (M <= -4.875423653967228e+48) {
tmp = t_0;
} else if (M <= -3.1905588265615016e-137) {
tmp = 0.25 * ((((M * M) * ((D * D) / (cbrt(d) * cbrt(d)))) * (h / cbrt(d))) / d);
} else {
double t_1 = 0.25 * (((M * M) * ((D * (D * h)) / d)) / d);
double tmp_1;
if (M <= -9.169952495142169e-295) {
tmp_1 = t_1;
} else if (M <= 7.259802738012728e-177) {
tmp_1 = (c0 / (2.0 * w)) * sqrt(-(M * M));
} else if (M <= 5.5286507786806465e+119) {
tmp_1 = t_1;
} else {
tmp_1 = t_0;
}
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 M < -4.8754236539672279e48 or 5.5286507786806465e119 < M Initial program 63.6
Taylor expanded around -inf 55.9
Simplified56.1
Taylor expanded around 0 53.0
Simplified53.0
rmApplied associate-/r*_binary6451.8
Simplified51.0
rmApplied associate-*l*_binary6435.4
if -4.8754236539672279e48 < M < -3.19055882656150157e-137Initial program 60.7
Taylor expanded around -inf 35.2
Simplified35.8
Taylor expanded around 0 27.6
Simplified27.6
rmApplied associate-/r*_binary6425.4
Simplified24.7
rmApplied add-cube-cbrt_binary6424.8
Applied times-frac_binary6423.9
Applied associate-*r*_binary6424.1
if -3.19055882656150157e-137 < M < -9.16995249514216853e-295 or 7.2598027380127283e-177 < M < 5.5286507786806465e119Initial program 58.9
Taylor expanded around -inf 37.3
Simplified38.2
Taylor expanded around 0 30.4
Simplified30.4
rmApplied associate-/r*_binary6427.4
Simplified26.8
rmApplied associate-*l*_binary6424.4
if -9.16995249514216853e-295 < M < 7.2598027380127283e-177Initial program 54.7
Taylor expanded around 0 27.6
Simplified27.6
Final simplification27.3
herbie shell --seed 2021196
(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))))))