(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (cbrt d) (cbrt h)))
(t_1 (* (fabs t_0) (sqrt t_0)))
(t_2 (pow (/ (* M D) (* d 2.0)) 2.0))
(t_3 (sqrt (/ d (cbrt l))))
(t_4 (* (cbrt l) (cbrt l))))
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_2) (/ h l))))
2.1905411552818913e+202)
(/ (* t_1 (* t_3 (fma t_2 (* (/ h l) -0.5) 1.0))) (sqrt t_4))
(* t_1 (* t_3 (sqrt (/ 1.0 t_4)))))))double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
double code(double d, double h, double l, double M, double D) {
double t_0 = cbrt(d) / cbrt(h);
double t_1 = fabs(t_0) * sqrt(t_0);
double t_2 = pow(((M * D) / (d * 2.0)), 2.0);
double t_3 = sqrt((d / cbrt(l)));
double t_4 = cbrt(l) * cbrt(l);
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_2) * (h / l)))) <= 2.1905411552818913e+202) {
tmp = (t_1 * (t_3 * fma(t_2, ((h / l) * -0.5), 1.0))) / sqrt(t_4);
} else {
tmp = t_1 * (t_3 * sqrt((1.0 / t_4)));
}
return tmp;
}
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function code(d, h, l, M, D) t_0 = Float64(cbrt(d) / cbrt(h)) t_1 = Float64(abs(t_0) * sqrt(t_0)) t_2 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0 t_3 = sqrt(Float64(d / cbrt(l))) t_4 = Float64(cbrt(l) * cbrt(l)) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_2) * Float64(h / l)))) <= 2.1905411552818913e+202) tmp = Float64(Float64(t_1 * Float64(t_3 * fma(t_2, Float64(Float64(h / l) * -0.5), 1.0))) / sqrt(t_4)); else tmp = Float64(t_1 * Float64(t_3 * sqrt(Float64(1.0 / t_4)))); end return tmp end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[d, 1/3], $MachinePrecision] / N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[t$95$0], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[l, 1/3], $MachinePrecision] * N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$2), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.1905411552818913e+202], N[(N[(t$95$1 * N[(t$95$3 * N[(t$95$2 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$3 * N[Sqrt[N[(1.0 / t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\begin{array}{l}
t_0 := \frac{\sqrt[3]{d}}{\sqrt[3]{h}}\\
t_1 := \left|t_0\right| \cdot \sqrt{t_0}\\
t_2 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_3 := \sqrt{\frac{d}{\sqrt[3]{\ell}}}\\
t_4 := \sqrt[3]{\ell} \cdot \sqrt[3]{\ell}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_2\right) \cdot \frac{h}{\ell}\right) \leq 2.1905411552818913 \cdot 10^{+202}:\\
\;\;\;\;\frac{t_1 \cdot \left(t_3 \cdot \mathsf{fma}\left(t_2, \frac{h}{\ell} \cdot -0.5, 1\right)\right)}{\sqrt{t_4}}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_3 \cdot \sqrt{\frac{1}{t_4}}\right)\\
\end{array}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 2.1905411552818913e202Initial program 12.7
Simplified12.7
Applied add-cube-cbrt_binary6413.0
Applied add-cube-cbrt_binary6413.2
Applied times-frac_binary6413.2
Applied sqrt-prod_binary6412.1
Simplified12.1
Applied add-cube-cbrt_binary6412.2
Applied *-un-lft-identity_binary6412.2
Applied times-frac_binary6412.2
Applied sqrt-prod_binary649.0
Applied associate-*l*_binary648.4
Applied sqrt-div_binary648.4
Applied associate-*l/_binary648.3
Applied associate-*l/_binary648.4
Applied associate-*r/_binary648.3
if 2.1905411552818913e202 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 56.3
Simplified56.3
Applied add-cube-cbrt_binary6456.4
Applied add-cube-cbrt_binary6456.4
Applied times-frac_binary6456.4
Applied sqrt-prod_binary6442.0
Simplified39.7
Applied add-cube-cbrt_binary6439.7
Applied *-un-lft-identity_binary6439.7
Applied times-frac_binary6439.7
Applied sqrt-prod_binary6434.8
Taylor expanded in M around 0 25.2
Final simplification13.5
herbie shell --seed 2022129
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))