\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}
\mathbf{if}\;D \leq -1.0014621651146908 \cdot 10^{+154}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot M\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}}{d}\\
\mathbf{elif}\;D \leq -1.2162146492768503 \cdot 10^{+85}:\\
\;\;\;\;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{elif}\;D \leq 5.81954129307857 \cdot 10^{+153}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \frac{h \cdot \left(D \cdot D\right)}{d}\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot e^{\left(\log \left(M \cdot M\right) + \left(\left(\log D + \log D\right) + \log h\right)\right) - \log \left(d \cdot d\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
(if (<= D -1.0014621651146908e+154)
(* 0.25 (/ (* (* M M) (/ (* D (* D h)) d)) d))
(if (<= D -1.2162146492768503e+85)
(*
0.25
(/ (* (* (* M M) (/ (* D D) (* (cbrt d) (cbrt d)))) (/ h (cbrt d))) d))
(if (<= D 5.81954129307857e+153)
(* 0.25 (/ (* M (* M (/ (* h (* D D)) d))) d))
(*
0.25
(exp
(-
(+ (log (* M M)) (+ (+ (log D) (log D)) (log h)))
(log (* 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 tmp;
if (D <= -1.0014621651146908e+154) {
tmp = 0.25 * (((M * M) * ((D * (D * h)) / d)) / d);
} else if (D <= -1.2162146492768503e+85) {
tmp = 0.25 * ((((M * M) * ((D * D) / (cbrt(d) * cbrt(d)))) * (h / cbrt(d))) / d);
} else if (D <= 5.81954129307857e+153) {
tmp = 0.25 * ((M * (M * ((h * (D * D)) / d))) / d);
} else {
tmp = 0.25 * exp((log(M * M) + ((log(D) + log(D)) + log(h))) - log(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 D < -1.0014621651146908e154Initial program 62.7
Taylor expanded around -inf 64.0
Simplified64.0
Taylor expanded around 0 64.0
Simplified64.0
rmApplied associate-/r*_binary64_104564.0
Simplified64.0
rmApplied associate-*l*_binary64_104247.1
if -1.0014621651146908e154 < D < -1.2162146492768503e85Initial program 57.0
Taylor expanded around -inf 46.2
Simplified48.3
Taylor expanded around 0 41.3
Simplified41.3
rmApplied associate-/r*_binary64_104537.8
Simplified36.1
rmApplied add-cube-cbrt_binary64_113636.3
Applied times-frac_binary64_110729.4
Applied associate-*r*_binary64_104130.1
if -1.2162146492768503e85 < D < 5.81954129307856981e153Initial program 59.0
Taylor expanded around -inf 38.3
Simplified38.9
Taylor expanded around 0 31.8
Simplified31.8
rmApplied associate-/r*_binary64_104528.9
Simplified28.3
rmApplied associate-*l*_binary64_104224.1
if 5.81954129307856981e153 < D Initial program 62.6
Taylor expanded around -inf 64.0
Simplified64.0
Taylor expanded around 0 64.0
Simplified64.0
rmApplied add-exp-log_binary64_113964.0
Applied add-exp-log_binary64_113964.0
Applied add-exp-log_binary64_113964.0
Applied add-exp-log_binary64_113964.0
Applied prod-exp_binary64_115064.0
Applied prod-exp_binary64_115056.2
Applied add-exp-log_binary64_113956.2
Applied prod-exp_binary64_115052.6
Applied div-exp_binary64_115252.0
Final simplification27.0
herbie shell --seed 2021069
(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))))))