\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 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;D \leq -9.879018091396131 \cdot 10^{+131}:\\
\;\;\;\;0.25 \cdot \frac{\frac{D}{\frac{\frac{d}{t_0}}{D}}}{d}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := 0.25 \cdot \frac{\left(D \cdot D\right) \cdot \frac{M \cdot \left(h \cdot M\right)}{d}}{d}\\
\mathbf{if}\;D \leq -1.57845886360931 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{t_0}{d}\\
\mathbf{if}\;D \leq -1.9928696319416464 \cdot 10^{-212}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(D \cdot t_2\right)}{d}\\
\mathbf{elif}\;D \leq 1.5268851672651507 \cdot 10^{-148}:\\
\;\;\;\;0.25 \cdot \log \left({\left(e^{t_2}\right)}^{\left(\frac{D \cdot D}{d}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\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 (* h (* M M))))
(if (<= D -9.879018091396131e+131)
(* 0.25 (/ (/ D (/ (/ d t_0) D)) d))
(let* ((t_1 (* 0.25 (/ (* (* D D) (/ (* M (* h M)) d)) d))))
(if (<= D -1.57845886360931e-173)
t_1
(let* ((t_2 (/ t_0 d)))
(if (<= D -1.9928696319416464e-212)
(* 0.25 (/ (* D (* D t_2)) d))
(if (<= D 1.5268851672651507e-148)
(* 0.25 (log (pow (exp t_2) (/ (* D D) d))))
t_1))))))))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 = h * (M * M);
double tmp;
if (D <= -9.879018091396131e+131) {
tmp = 0.25 * ((D / ((d / t_0) / D)) / d);
} else {
double t_1 = 0.25 * (((D * D) * ((M * (h * M)) / d)) / d);
double tmp_1;
if (D <= -1.57845886360931e-173) {
tmp_1 = t_1;
} else {
double t_2 = t_0 / d;
double tmp_2;
if (D <= -1.9928696319416464e-212) {
tmp_2 = 0.25 * ((D * (D * t_2)) / d);
} else if (D <= 1.5268851672651507e-148) {
tmp_2 = 0.25 * log(pow(exp(t_2), ((D * D) / d)));
} else {
tmp_2 = t_1;
}
tmp_1 = tmp_2;
}
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 D < -9.8790180913961314e131Initial program 62.6
Taylor expanded around -inf 61.4
Simplified61.5
Taylor expanded around 0 60.4
Simplified60.4
rmApplied associate-/r*_binary6460.1
Simplified60.3
rmApplied clear-num_binary6460.4
Applied un-div-inv_binary6460.4
Applied associate-/l*_binary6439.5
if -9.8790180913961314e131 < D < -1.57845886360931e-173 or 1.52688516726515065e-148 < D Initial program 57.0
Taylor expanded around -inf 41.4
Simplified42.7
Taylor expanded around 0 34.4
Simplified34.4
rmApplied associate-/r*_binary6432.5
Simplified31.6
rmApplied associate-*r*_binary6428.7
if -1.57845886360931e-173 < D < -1.992869631941646e-212Initial program 64.0
Taylor expanded around -inf 38.6
Simplified40.3
Taylor expanded around 0 32.7
Simplified32.7
rmApplied associate-/r*_binary6430.1
Simplified30.1
rmApplied associate-*l*_binary6426.8
if -1.992869631941646e-212 < D < 1.52688516726515065e-148Initial program 63.7
Taylor expanded around -inf 40.9
Simplified42.5
Taylor expanded around 0 34.1
Simplified34.1
rmApplied associate-/r*_binary6429.8
Simplified29.8
rmApplied add-log-exp_binary6430.0
Simplified24.2
Final simplification27.7
herbie shell --seed 2021211
(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))))))