(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 (pow (/ 1.0 (* (cbrt h) (cbrt h))) 0.5))
(t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
(t_2 (* (sqrt (/ 1.0 (* (cbrt l) (cbrt l)))) (sqrt (/ d (cbrt l)))))
(t_3 (cbrt (cbrt h))))
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_1) (/ h l))))
1.0478229292966753e+260)
(*
(* t_0 (pow (/ d (cbrt h)) 0.5))
(* t_2 (fma -0.5 (* t_1 (/ h l)) 1.0)))
(*
(* t_2 (* t_0 (* (sqrt (/ 1.0 (* t_3 t_3))) (sqrt (/ d t_3)))))
(- 1.0 (/ (* 0.5 (* h t_1)) l))))))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 = pow((1.0 / (cbrt(h) * cbrt(h))), 0.5);
double t_1 = pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = sqrt((1.0 / (cbrt(l) * cbrt(l)))) * sqrt((d / cbrt(l)));
double t_3 = cbrt(cbrt(h));
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)))) <= 1.0478229292966753e+260) {
tmp = (t_0 * pow((d / cbrt(h)), 0.5)) * (t_2 * fma(-0.5, (t_1 * (h / l)), 1.0));
} else {
tmp = (t_2 * (t_0 * (sqrt((1.0 / (t_3 * t_3))) * sqrt((d / t_3))))) * (1.0 - ((0.5 * (h * t_1)) / l));
}
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(1.0 / Float64(cbrt(h) * cbrt(h))) ^ 0.5 t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0 t_2 = Float64(sqrt(Float64(1.0 / Float64(cbrt(l) * cbrt(l)))) * sqrt(Float64(d / cbrt(l)))) t_3 = cbrt(cbrt(h)) 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)))) <= 1.0478229292966753e+260) tmp = Float64(Float64(t_0 * (Float64(d / cbrt(h)) ^ 0.5)) * Float64(t_2 * fma(-0.5, Float64(t_1 * Float64(h / l)), 1.0))); else tmp = Float64(Float64(t_2 * Float64(t_0 * Float64(sqrt(Float64(1.0 / Float64(t_3 * t_3))) * sqrt(Float64(d / t_3))))) * Float64(1.0 - Float64(Float64(0.5 * Float64(h * t_1)) / l))); 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[Power[N[(1.0 / N[(N[Power[h, 1/3], $MachinePrecision] * N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $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[(N[Sqrt[N[(1.0 / N[(N[Power[l, 1/3], $MachinePrecision] * N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Power[h, 1/3], $MachinePrecision], 1/3], $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], 1.0478229292966753e+260], N[(N[(t$95$0 * N[Power[N[(d / N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(-0.5 * N[(t$95$1 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[N[(1.0 / N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(h * t$95$1), $MachinePrecision]), $MachinePrecision] / l), $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 := {\left(\frac{1}{\sqrt[3]{h} \cdot \sqrt[3]{h}}\right)}^{0.5}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \sqrt{\frac{1}{\sqrt[3]{\ell} \cdot \sqrt[3]{\ell}}} \cdot \sqrt{\frac{d}{\sqrt[3]{\ell}}}\\
t_3 := \sqrt[3]{\sqrt[3]{h}}\\
\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 1.0478229292966753 \cdot 10^{+260}:\\
\;\;\;\;\left(t_0 \cdot {\left(\frac{d}{\sqrt[3]{h}}\right)}^{0.5}\right) \cdot \left(t_2 \cdot \mathsf{fma}\left(-0.5, t_1 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 \cdot \left(t_0 \cdot \left(\sqrt{\frac{1}{t_3 \cdot t_3}} \cdot \sqrt{\frac{d}{t_3}}\right)\right)\right) \cdot \left(1 - \frac{0.5 \cdot \left(h \cdot t_1\right)}{\ell}\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)))) < 1.04782292929667528e260Initial program 12.8
Applied add-cube-cbrt_binary6413.1
Applied *-un-lft-identity_binary6413.1
Applied times-frac_binary6413.1
Applied unpow-prod-down_binary6412.2
Applied add-cube-cbrt_binary6412.3
Applied *-un-lft-identity_binary6412.3
Applied times-frac_binary6412.3
Applied unpow-prod-down_binary648.8
Simplified8.8
Simplified8.8
Applied associate-*l*_binary648.2
Simplified8.2
if 1.04782292929667528e260 < (*.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 62.9
Applied add-cube-cbrt_binary6462.9
Applied *-un-lft-identity_binary6462.9
Applied times-frac_binary6462.9
Applied unpow-prod-down_binary6446.9
Applied add-cube-cbrt_binary6446.9
Applied *-un-lft-identity_binary6446.9
Applied times-frac_binary6446.9
Applied unpow-prod-down_binary6442.4
Simplified42.4
Simplified42.4
Applied add-cube-cbrt_binary6442.5
Applied *-un-lft-identity_binary6442.5
Applied times-frac_binary6442.4
Applied unpow-prod-down_binary6439.7
Simplified39.7
Simplified39.7
Applied associate-*r/_binary6430.1
Simplified30.1
Final simplification14.4
herbie shell --seed 2022138
(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)))))