(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 (/ d (* D (/ M 2.0))))
(t_1 (pow (/ d l) 0.5))
(t_2 (+ 1.0 (/ (* (pow (* d (/ (/ 2.0 D) M)) -2.0) -0.5) (/ l h))))
(t_3 (pow (/ d h) 0.5)))
(if (<= l -1.2023678231762978e-21)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_1) t_2)
(if (<= l 3.1202928822756546e-191)
(*
(* t_1 t_3)
(+
1.0
(*
(/ (* (sqrt 0.5) (/ 1.0 t_0)) l)
(/ (* (sqrt 0.5) (/ -1.0 t_0)) (/ 1.0 h)))))
(if (<= l 1.6985331578856946e+223)
(* t_2 (* t_1 (/ (sqrt d) (sqrt h))))
(if (<= l 5.899305990900873e+261)
(* t_2 (* t_3 (* (sqrt d) (pow (/ 1.0 l) 0.5))))
(* t_2 (* t_1 (* (sqrt d) (pow (/ 1.0 h) 0.5))))))))))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 = d / (D * (M / 2.0));
double t_1 = pow((d / l), 0.5);
double t_2 = 1.0 + ((pow((d * ((2.0 / D) / M)), -2.0) * -0.5) / (l / h));
double t_3 = pow((d / h), 0.5);
double tmp;
if (l <= -1.2023678231762978e-21) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2;
} else if (l <= 3.1202928822756546e-191) {
tmp = (t_1 * t_3) * (1.0 + (((sqrt(0.5) * (1.0 / t_0)) / l) * ((sqrt(0.5) * (-1.0 / t_0)) / (1.0 / h))));
} else if (l <= 1.6985331578856946e+223) {
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
} else if (l <= 5.899305990900873e+261) {
tmp = t_2 * (t_3 * (sqrt(d) * pow((1.0 / l), 0.5)));
} else {
tmp = t_2 * (t_1 * (sqrt(d) * pow((1.0 / h), 0.5)));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = d / (d_1 * (m / 2.0d0))
t_1 = (d / l) ** 0.5d0
t_2 = 1.0d0 + ((((d * ((2.0d0 / d_1) / m)) ** (-2.0d0)) * (-0.5d0)) / (l / h))
t_3 = (d / h) ** 0.5d0
if (l <= (-1.2023678231762978d-21)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2
else if (l <= 3.1202928822756546d-191) then
tmp = (t_1 * t_3) * (1.0d0 + (((sqrt(0.5d0) * (1.0d0 / t_0)) / l) * ((sqrt(0.5d0) * ((-1.0d0) / t_0)) / (1.0d0 / h))))
else if (l <= 1.6985331578856946d+223) then
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)))
else if (l <= 5.899305990900873d+261) then
tmp = t_2 * (t_3 * (sqrt(d) * ((1.0d0 / l) ** 0.5d0)))
else
tmp = t_2 * (t_1 * (sqrt(d) * ((1.0d0 / h) ** 0.5d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / (D * (M / 2.0));
double t_1 = Math.pow((d / l), 0.5);
double t_2 = 1.0 + ((Math.pow((d * ((2.0 / D) / M)), -2.0) * -0.5) / (l / h));
double t_3 = Math.pow((d / h), 0.5);
double tmp;
if (l <= -1.2023678231762978e-21) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_1) * t_2;
} else if (l <= 3.1202928822756546e-191) {
tmp = (t_1 * t_3) * (1.0 + (((Math.sqrt(0.5) * (1.0 / t_0)) / l) * ((Math.sqrt(0.5) * (-1.0 / t_0)) / (1.0 / h))));
} else if (l <= 1.6985331578856946e+223) {
tmp = t_2 * (t_1 * (Math.sqrt(d) / Math.sqrt(h)));
} else if (l <= 5.899305990900873e+261) {
tmp = t_2 * (t_3 * (Math.sqrt(d) * Math.pow((1.0 / l), 0.5)));
} else {
tmp = t_2 * (t_1 * (Math.sqrt(d) * Math.pow((1.0 / h), 0.5)));
}
return tmp;
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
def code(d, h, l, M, D): t_0 = d / (D * (M / 2.0)) t_1 = math.pow((d / l), 0.5) t_2 = 1.0 + ((math.pow((d * ((2.0 / D) / M)), -2.0) * -0.5) / (l / h)) t_3 = math.pow((d / h), 0.5) tmp = 0 if l <= -1.2023678231762978e-21: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_1) * t_2 elif l <= 3.1202928822756546e-191: tmp = (t_1 * t_3) * (1.0 + (((math.sqrt(0.5) * (1.0 / t_0)) / l) * ((math.sqrt(0.5) * (-1.0 / t_0)) / (1.0 / h)))) elif l <= 1.6985331578856946e+223: tmp = t_2 * (t_1 * (math.sqrt(d) / math.sqrt(h))) elif l <= 5.899305990900873e+261: tmp = t_2 * (t_3 * (math.sqrt(d) * math.pow((1.0 / l), 0.5))) else: tmp = t_2 * (t_1 * (math.sqrt(d) * math.pow((1.0 / h), 0.5))) 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(d / Float64(D * Float64(M / 2.0))) t_1 = Float64(d / l) ^ 0.5 t_2 = Float64(1.0 + Float64(Float64((Float64(d * Float64(Float64(2.0 / D) / M)) ^ -2.0) * -0.5) / Float64(l / h))) t_3 = Float64(d / h) ^ 0.5 tmp = 0.0 if (l <= -1.2023678231762978e-21) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1) * t_2); elseif (l <= 3.1202928822756546e-191) tmp = Float64(Float64(t_1 * t_3) * Float64(1.0 + Float64(Float64(Float64(sqrt(0.5) * Float64(1.0 / t_0)) / l) * Float64(Float64(sqrt(0.5) * Float64(-1.0 / t_0)) / Float64(1.0 / h))))); elseif (l <= 1.6985331578856946e+223) tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); elseif (l <= 5.899305990900873e+261) tmp = Float64(t_2 * Float64(t_3 * Float64(sqrt(d) * (Float64(1.0 / l) ^ 0.5)))); else tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) * (Float64(1.0 / h) ^ 0.5)))); end return tmp end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
function tmp_2 = code(d, h, l, M, D) t_0 = d / (D * (M / 2.0)); t_1 = (d / l) ^ 0.5; t_2 = 1.0 + ((((d * ((2.0 / D) / M)) ^ -2.0) * -0.5) / (l / h)); t_3 = (d / h) ^ 0.5; tmp = 0.0; if (l <= -1.2023678231762978e-21) tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2; elseif (l <= 3.1202928822756546e-191) tmp = (t_1 * t_3) * (1.0 + (((sqrt(0.5) * (1.0 / t_0)) / l) * ((sqrt(0.5) * (-1.0 / t_0)) / (1.0 / h)))); elseif (l <= 1.6985331578856946e+223) tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h))); elseif (l <= 5.899305990900873e+261) tmp = t_2 * (t_3 * (sqrt(d) * ((1.0 / l) ^ 0.5))); else tmp = t_2 * (t_1 * (sqrt(d) * ((1.0 / h) ^ 0.5))); end tmp_2 = 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[(d / N[(D * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(N[(N[Power[N[(d * N[(N[(2.0 / D), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] * -0.5), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[l, -1.2023678231762978e-21], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, 3.1202928822756546e-191], N[(N[(t$95$1 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6985331578856946e+223], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.899305990900873e+261], N[(t$95$2 * N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] * N[Power[N[(1.0 / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] * N[Power[N[(1.0 / h), $MachinePrecision], 0.5], $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{d}{D \cdot \frac{M}{2}}\\
t_1 := {\left(\frac{d}{\ell}\right)}^{0.5}\\
t_2 := 1 + \frac{{\left(d \cdot \frac{\frac{2}{D}}{M}\right)}^{-2} \cdot -0.5}{\frac{\ell}{h}}\\
t_3 := {\left(\frac{d}{h}\right)}^{0.5}\\
\mathbf{if}\;\ell \leq -1.2023678231762978 \cdot 10^{-21}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_1\right) \cdot t_2\\
\mathbf{elif}\;\ell \leq 3.1202928822756546 \cdot 10^{-191}:\\
\;\;\;\;\left(t_1 \cdot t_3\right) \cdot \left(1 + \frac{\sqrt{0.5} \cdot \frac{1}{t_0}}{\ell} \cdot \frac{\sqrt{0.5} \cdot \frac{-1}{t_0}}{\frac{1}{h}}\right)\\
\mathbf{elif}\;\ell \leq 1.6985331578856946 \cdot 10^{+223}:\\
\;\;\;\;t_2 \cdot \left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\mathbf{elif}\;\ell \leq 5.899305990900873 \cdot 10^{+261}:\\
\;\;\;\;t_2 \cdot \left(t_3 \cdot \left(\sqrt{d} \cdot {\left(\frac{1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 \cdot \left(\sqrt{d} \cdot {\left(\frac{1}{h}\right)}^{0.5}\right)\right)\\
\end{array}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
Results
if l < -1.2023678231762978e-21Initial program 26.9
Applied egg-rr26.9
Applied egg-rr26.9
Applied egg-rr26.8
Applied egg-rr18.6
if -1.2023678231762978e-21 < l < 3.12029288227565458e-191Initial program 29.6
Applied egg-rr29.7
Applied egg-rr29.7
Applied egg-rr29.0
Applied egg-rr24.1
if 3.12029288227565458e-191 < l < 1.69853315788569463e223Initial program 23.5
Applied egg-rr23.6
Applied egg-rr23.5
Applied egg-rr23.3
Applied egg-rr16.3
if 1.69853315788569463e223 < l < 5.8993059909008734e261Initial program 31.8
Applied egg-rr31.8
Applied egg-rr31.8
Applied egg-rr31.6
Applied egg-rr24.1
if 5.8993059909008734e261 < l Initial program 33.1
Applied egg-rr33.1
Applied egg-rr33.1
Applied egg-rr33.0
Applied egg-rr24.6
Final simplification19.5
herbie shell --seed 2022148
(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)))))