\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.7477617212624623 \cdot 10^{+148}:\\
\;\;\;\;0.25 \cdot \frac{e^{\mathsf{fma}\left(2, \log \left(M \cdot D\right), -\log \left(\frac{d}{h}\right)\right)}}{d}\\
\mathbf{elif}\;M \leq 2.795396578891542 \cdot 10^{+127}:\\
\;\;\;\;0.25 \cdot \frac{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{\sqrt[3]{d} \cdot \sqrt[3]{d}}\right) \cdot \frac{D}{\sqrt[3]{d}}}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot e^{\left(\log \left({D}^{2}\right) + \left(2 \cdot \log M + \log h\right)\right) - \log \left({d}^{2}\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.7477617212624623e+148)
(* 0.25 (/ (exp (fma 2.0 (log (* M D)) (- (log (/ d h))))) d))
(if (<= M 2.795396578891542e+127)
(*
0.25
(/ (* (* (* h (* M M)) (/ D (* (cbrt d) (cbrt d)))) (/ D (cbrt d))) d))
(*
0.25
(exp
(-
(+ (log (pow D 2.0)) (+ (* 2.0 (log M)) (log h)))
(log (pow d 2.0))))))))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.7477617212624623e+148) {
tmp = 0.25 * (exp(fma(2.0, log(M * D), -log(d / h))) / d);
} else if (M <= 2.795396578891542e+127) {
tmp = 0.25 * ((((h * (M * M)) * (D / (cbrt(d) * cbrt(d)))) * (D / cbrt(d))) / d);
} else {
tmp = 0.25 * exp((log(pow(D, 2.0)) + ((2.0 * log(M)) + log(h))) - log(pow(d, 2.0)));
}
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
if M < -1.7477617212624623e148Initial program 64.0
Taylor expanded in c0 around -inf 63.2
Taylor expanded in c0 around 0 63.1
Applied unpow2_binary6463.1
Applied associate-/r*_binary6463.1
Simplified63.0
Applied add-exp-log_binary6463.6
Applied add-exp-log_binary6463.8
Applied add-exp-log_binary6463.8
Applied prod-exp_binary6463.8
Applied div-exp_binary6463.6
Applied add-exp-log_binary6464.0
Applied add-exp-log_binary6464.0
Applied prod-exp_binary6464.0
Applied add-exp-log_binary6464.0
Applied prod-exp_binary6464.0
Applied prod-exp_binary6464.0
Simplified52.9
if -1.7477617212624623e148 < M < 2.7953965788915422e127Initial program 58.9
Taylor expanded in c0 around -inf 38.7
Taylor expanded in c0 around 0 31.0
Applied unpow2_binary6431.0
Applied associate-/r*_binary6428.0
Simplified27.5
Applied add-cube-cbrt_binary6427.5
Applied times-frac_binary6424.1
Applied associate-*r*_binary6422.4
if 2.7953965788915422e127 < M Initial program 64.0
Taylor expanded in c0 around -inf 61.3
Taylor expanded in c0 around 0 59.7
Applied add-exp-log_binary6459.8
Applied add-exp-log_binary6461.5
Applied pow-to-exp_binary6461.5
Applied prod-exp_binary6457.7
Applied add-exp-log_binary6457.7
Applied prod-exp_binary6452.9
Applied div-exp_binary6451.8
Final simplification27.0
herbie shell --seed 2022068
(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))))))