(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 l) (cbrt l)))
(t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
(t_2 (cbrt (cbrt l)))
(t_3 (/ (cbrt d) t_2))
(t_4 (sqrt t_3))
(t_5 (/ (cbrt d) (cbrt h)))
(t_6 (sqrt t_5)))
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_1) (/ h l))))
2.3492693856436336e+92)
(/
(* (fma t_1 (* (/ h l) -0.5) 1.0) (* (* (cbrt d) t_4) (* (cbrt d) t_6)))
(* (fabs (cbrt h)) (* (sqrt t_0) (fabs t_2))))
(* (* t_6 (fabs t_5)) (* (sqrt (/ 1.0 t_0)) (* t_4 (fabs t_3)))))))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(l) * cbrt(l);
double t_1 = pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = cbrt(cbrt(l));
double t_3 = cbrt(d) / t_2;
double t_4 = sqrt(t_3);
double t_5 = cbrt(d) / cbrt(h);
double t_6 = sqrt(t_5);
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)))) <= 2.3492693856436336e+92) {
tmp = (fma(t_1, ((h / l) * -0.5), 1.0) * ((cbrt(d) * t_4) * (cbrt(d) * t_6))) / (fabs(cbrt(h)) * (sqrt(t_0) * fabs(t_2)));
} else {
tmp = (t_6 * fabs(t_5)) * (sqrt((1.0 / t_0)) * (t_4 * fabs(t_3)));
}
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(l) * cbrt(l)) t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0 t_2 = cbrt(cbrt(l)) t_3 = Float64(cbrt(d) / t_2) t_4 = sqrt(t_3) t_5 = Float64(cbrt(d) / cbrt(h)) t_6 = sqrt(t_5) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))) <= 2.3492693856436336e+92) tmp = Float64(Float64(fma(t_1, Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(cbrt(d) * t_4) * Float64(cbrt(d) * t_6))) / Float64(abs(cbrt(h)) * Float64(sqrt(t_0) * abs(t_2)))); else tmp = Float64(Float64(t_6 * abs(t_5)) * Float64(sqrt(Float64(1.0 / t_0)) * Float64(t_4 * abs(t_3)))); 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[l, 1/3], $MachinePrecision] * N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Power[l, 1/3], $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[d, 1/3], $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[(N[Power[d, 1/3], $MachinePrecision] / N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[t$95$5], $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$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.3492693856436336e+92], N[(N[(N[(t$95$1 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Power[d, 1/3], $MachinePrecision] * t$95$4), $MachinePrecision] * N[(N[Power[d, 1/3], $MachinePrecision] * t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[N[Power[h, 1/3], $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$6 * N[Abs[t$95$5], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision] * N[(t$95$4 * N[Abs[t$95$3], $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 := \sqrt[3]{\ell} \cdot \sqrt[3]{\ell}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \sqrt[3]{\sqrt[3]{\ell}}\\
t_3 := \frac{\sqrt[3]{d}}{t_2}\\
t_4 := \sqrt{t_3}\\
t_5 := \frac{\sqrt[3]{d}}{\sqrt[3]{h}}\\
t_6 := \sqrt{t_5}\\
\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_1\right) \cdot \frac{h}{\ell}\right) \leq 2.3492693856436336 \cdot 10^{+92}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t_1, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \left(\left(\sqrt[3]{d} \cdot t_4\right) \cdot \left(\sqrt[3]{d} \cdot t_6\right)\right)}{\left|\sqrt[3]{h}\right| \cdot \left(\sqrt{t_0} \cdot \left|t_2\right|\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(t_6 \cdot \left|t_5\right|\right) \cdot \left(\sqrt{\frac{1}{t_0}} \cdot \left(t_4 \cdot \left|t_3\right|\right)\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.34926938564363357e92Initial program 15.2
Simplified15.2
Applied add-cube-cbrt_binary6415.5
Applied add-cube-cbrt_binary6415.6
Applied times-frac_binary6415.6
Applied sqrt-prod_binary6414.3
Simplified14.3
Applied add-cube-cbrt_binary6414.4
Applied *-un-lft-identity_binary6414.4
Applied times-frac_binary6414.4
Applied sqrt-prod_binary6410.4
Applied add-cube-cbrt_binary6410.5
Applied add-cube-cbrt_binary6410.7
Applied times-frac_binary6410.7
Applied sqrt-prod_binary6410.2
Simplified10.2
Applied fabs-div_binary6410.2
Applied associate-*l/_binary6410.2
Applied sqrt-div_binary6410.2
Applied frac-times_binary6410.2
Applied fabs-div_binary6410.2
Applied associate-*l/_binary6410.2
Applied frac-times_binary6410.2
Applied associate-*l/_binary649.7
Simplified9.7
if 2.34926938564363357e92 < (*.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 41.4
Simplified41.4
Applied add-cube-cbrt_binary6441.6
Applied add-cube-cbrt_binary6441.6
Applied times-frac_binary6441.6
Applied sqrt-prod_binary6430.5
Simplified28.9
Applied add-cube-cbrt_binary6429.0
Applied *-un-lft-identity_binary6429.0
Applied times-frac_binary6429.0
Applied sqrt-prod_binary6425.5
Applied add-cube-cbrt_binary6425.6
Applied add-cube-cbrt_binary6425.7
Applied times-frac_binary6425.7
Applied sqrt-prod_binary6425.2
Simplified25.2
Taylor expanded in M around 0 16.2
Final simplification12.5
herbie shell --seed 2022131
(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)))))