\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 -2.5521439251508326 \cdot 10^{+127}:\\
\;\;\;\;0.25 \cdot \frac{\frac{e^{\mathsf{fma}\left(2, \log \left(M \cdot D\right), \log h\right)}}{d}}{d}\\
\mathbf{elif}\;M \leq 3.4252903958142705 \cdot 10^{+75}:\\
\;\;\;\;0.25 \cdot \left(\frac{D}{d} \cdot \frac{D \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\frac{D \cdot \left(D \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)}{d}}{d}\\
\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 -2.5521439251508326e+127)
(* 0.25 (/ (/ (exp (fma 2.0 (log (* M D)) (log h))) d) d))
(if (<= M 3.4252903958142705e+75)
(* 0.25 (* (/ D d) (/ (* D (* h (* M M))) d)))
(* 0.25 (/ (/ (* D (* D (* M (* M h)))) 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 <= -2.5521439251508326e+127) {
tmp = 0.25 * ((exp(fma(2.0, log(M * D), log(h))) / d) / d);
} else if (M <= 3.4252903958142705e+75) {
tmp = 0.25 * ((D / d) * ((D * (h * (M * M))) / d));
} else {
tmp = 0.25 * (((D * (D * (M * (M * h)))) / 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
if M < -2.5521439251508326e127Initial program 64.0
Taylor expanded in c0 around -inf 59.9
Applied unpow2_binary6459.9
Applied associate-/r*_binary6459.5
Applied add-exp-log_binary6461.7
Applied pow-to-exp_binary6464.0
Applied prod-exp_binary6464.0
Applied pow-to-exp_binary6464.0
Applied prod-exp_binary6464.0
Simplified55.2
if -2.5521439251508326e127 < M < 3.42529039581427048e75Initial program 58.4
Taylor expanded in c0 around -inf 30.5
Applied unpow2_binary6430.5
Applied associate-/r*_binary6427.5
Applied unpow2_binary6427.5
Applied associate-*l*_binary6423.7
Simplified23.7
Applied add-sqr-sqrt_binary6443.5
Applied add-sqr-sqrt_binary6443.6
Applied times-frac_binary6442.6
Applied times-frac_binary6442.5
Simplified42.5
Simplified21.6
if 3.42529039581427048e75 < M Initial program 63.5
Taylor expanded in c0 around -inf 53.5
Applied unpow2_binary6453.5
Applied associate-/r*_binary6452.5
Applied unpow2_binary6452.5
Applied associate-*l*_binary6451.3
Simplified51.3
Applied associate-*r*_binary6441.7
Final simplification26.9
herbie shell --seed 2022063
(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))))))