\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)\\
t_1 := 0.25 \cdot \frac{D \cdot \left(t_0 \cdot \frac{D}{d}\right)}{d}\\
\mathbf{if}\;D \leq -4.031642161132083 \cdot 10^{-277}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{D \cdot D}{d}\\
\mathbf{if}\;D \leq 4.7072638932713915 \cdot 10^{-121}:\\
\;\;\;\;0.25 \cdot \log \left({\left(e^{t_2}\right)}^{\left(\frac{t_0}{d}\right)}\right)\\
\mathbf{elif}\;D \leq 1.5278585707073579 \cdot 10^{+152}:\\
\;\;\;\;0.25 \cdot \frac{t_2 \cdot \left(M \cdot \left(h \cdot M\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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))) (t_1 (* 0.25 (/ (* D (* t_0 (/ D d))) d))))
(if (<= D -4.031642161132083e-277)
t_1
(let* ((t_2 (/ (* D D) d)))
(if (<= D 4.7072638932713915e-121)
(* 0.25 (log (pow (exp t_2) (/ t_0 d))))
(if (<= D 1.5278585707073579e+152)
(* 0.25 (/ (* t_2 (* M (* h M))) 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 t_1 = 0.25 * ((D * (t_0 * (D / d))) / d);
double tmp;
if (D <= -4.031642161132083e-277) {
tmp = t_1;
} else {
double t_2 = (D * D) / d;
double tmp_1;
if (D <= 4.7072638932713915e-121) {
tmp_1 = 0.25 * log(pow(exp(t_2), (t_0 / d)));
} else if (D <= 1.5278585707073579e+152) {
tmp_1 = 0.25 * ((t_2 * (M * (h * M))) / d);
} else {
tmp_1 = t_1;
}
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 < -4.03164216113208287e-277 or 1.52785857070735787e152 < D Initial program 59.4
Taylor expanded around -inf 44.9
Simplified46.3
Taylor expanded around 0 39.4
Simplified39.4
rmApplied associate-/r*_binary6437.5
Simplified36.7
rmApplied *-un-lft-identity_binary6436.7
Applied times-frac_binary6431.6
Applied associate-*l*_binary6429.6
Simplified29.6
if -4.03164216113208287e-277 < D < 4.7072638932713915e-121Initial program 63.0
Taylor expanded around -inf 39.3
Simplified41.4
Taylor expanded around 0 33.1
Simplified33.1
rmApplied associate-/r*_binary6429.4
Simplified29.1
rmApplied add-log-exp_binary6429.8
Simplified24.6
if 4.7072638932713915e-121 < D < 1.52785857070735787e152Initial program 56.0
Taylor expanded around -inf 39.0
Simplified40.5
Taylor expanded around 0 31.2
Simplified31.2
rmApplied associate-/r*_binary6428.7
Simplified27.3
rmApplied associate-*l*_binary6423.9
Simplified23.9
Final simplification26.9
herbie shell --seed 2021204
(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))))))