\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 -4.586460145529938 \cdot 10^{+201}:\\
\;\;\;\;0.25 \cdot \frac{e^{\log h + 2 \cdot \log \left(M \cdot D\right)}}{d \cdot d}\\
\mathbf{elif}\;M \leq 5.580625602124698 \cdot 10^{+144}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(D \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot e^{\left(\log \left(D \cdot D\right) + \left(\log h + \left(\log M + \log M\right)\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 -4.586460145529938e+201)
(* 0.25 (/ (exp (+ (log h) (* 2.0 (log (* M D))))) (* d d)))
(if (<= M 5.580625602124698e+144)
(* 0.25 (/ (* D (* D (/ (* h (* M M)) d))) d))
(*
0.25
(exp
(- (+ (log (* D D)) (+ (log h) (+ (log M) (log M)))) (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 <= -4.586460145529938e+201) {
tmp = 0.25 * (exp(log(h) + (2.0 * log(M * D))) / (d * d));
} else if (M <= 5.580625602124698e+144) {
tmp = 0.25 * ((D * (D * ((h * (M * M)) / d))) / d);
} else {
tmp = 0.25 * exp((log(D * D) + (log(h) + (log(M) + log(M)))) - 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 < -4.58646014552993779e201Initial program 64.0
Taylor expanded in c0 around -inf 64.0
Simplified64.0
Taylor expanded in c0 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 prod-exp_binary6464.0
Applied add-exp-log_binary6464.0
Applied add-exp-log_binary6464.0
Applied prod-exp_binary6464.0
Applied prod-exp_binary6464.0
Simplified53.9
if -4.58646014552993779e201 < M < 5.58062560212469821e144Initial program 58.6
Taylor expanded in c0 around -inf 39.1
Simplified39.1
Taylor expanded in c0 around 0 31.6
Simplified31.6
rmApplied associate-/r*_binary6428.8
Simplified28.2
rmApplied associate-*l*_binary6424.5
if 5.58062560212469821e144 < M Initial program 64.0
Taylor expanded in c0 around -inf 63.1
Simplified63.1
Taylor expanded in c0 around 0 62.1
Simplified62.1
rmApplied add-exp-log_binary6462.1
Applied add-exp-log_binary6463.5
Applied add-exp-log_binary6463.5
Applied add-exp-log_binary6463.5
Applied prod-exp_binary6463.5
Applied prod-exp_binary6457.7
Applied add-exp-log_binary6457.7
Applied prod-exp_binary6451.3
Applied div-exp_binary6450.3
Final simplification27.7
herbie shell --seed 2021197
(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))))))