\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}\;M \leq -1.5961129530600776 \cdot 10^{+143}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \left(M \cdot \frac{\left(D \cdot D\right) \cdot h}{d}\right)}{d}\\
\mathbf{elif}\;M \leq 1.338118781860413 \cdot 10^{+154}:\\
\;\;\;\;0.25 \cdot \frac{\left(M \cdot M\right) \cdot \frac{D \cdot \left(D \cdot h\right)}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot e^{\left(\left(\log M + \log M\right) + \left(\log \left(D \cdot 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 (<= M -1.5961129530600776e+143)
(* 0.25 (/ (* M (* M (/ (* (* D D) h) d))) d))
(if (<= M 1.338118781860413e+154)
(* 0.25 (/ (* (* M M) (/ (* D (* D h)) d)) d))
(*
0.25
(exp
(- (+ (+ (log M) (log M)) (+ (log (* D 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 (M <= -1.5961129530600776e+143) {
tmp = 0.25 * ((M * (M * (((D * D) * h) / d))) / d);
} else if (M <= 1.338118781860413e+154) {
tmp = 0.25 * (((M * M) * ((D * (D * h)) / d)) / d);
} else {
tmp = 0.25 * exp(((log(M) + log(M)) + (log(D * 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 M < -1.5961129530600776e143Initial program 64.0
Taylor expanded around -inf 62.2
Simplified62.3
Taylor expanded around 0 61.6
Simplified61.6
rmApplied associate-/r*_binary6461.2
Simplified61.4
rmApplied associate-*l*_binary6439.5
if -1.5961129530600776e143 < M < 1.3381187818604131e154Initial program 58.8
Taylor expanded around -inf 37.5
Simplified38.3
Taylor expanded around 0 30.8
Simplified30.8
rmApplied associate-/r*_binary6427.7
Simplified27.1
rmApplied associate-*l*_binary6424.3
if 1.3381187818604131e154 < M Initial program 64.0
Taylor expanded around -inf 64.0
Simplified64.0
Taylor expanded around 0 64.0
Simplified64.0
rmApplied add-exp-log_binary6464.0
Applied add-exp-log_binary6464.0
Applied add-exp-log_binary6464.0
Applied prod-exp_binary6464.0
Applied add-exp-log_binary6464.0
Applied add-exp-log_binary6464.0
Applied prod-exp_binary6464.0
Applied prod-exp_binary6454.2
Applied div-exp_binary6453.1
Final simplification27.3
herbie shell --seed 2021148
(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))))))