(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 (/ 1.0 (sqrt (/ l d))))
(t_1 (- 1.0 (/ (* h (* 0.5 (pow (* (/ M 2.0) (/ D d)) 2.0))) l)))
(t_2 (pow (/ d h) 0.5))
(t_3 (sqrt (- d)))
(t_4
(-
1.0
(pow (/ (* (/ (* M (* 0.5 D)) d) (sqrt 0.5)) (sqrt (/ l h))) 2.0))))
(if (<= d -1.35e+52)
(* (* (/ t_3 (sqrt (- h))) t_0) t_1)
(if (<= d 0.0)
(* (* t_2 (/ t_3 (sqrt (- l)))) t_4)
(if (<= d 3.8e+19)
(* t_4 (* t_2 (/ (sqrt d) (sqrt l))))
(* t_1 (* t_0 (/ (sqrt d) (sqrt h)))))))))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 = 1.0 / sqrt((l / d));
double t_1 = 1.0 - ((h * (0.5 * pow(((M / 2.0) * (D / d)), 2.0))) / l);
double t_2 = pow((d / h), 0.5);
double t_3 = sqrt(-d);
double t_4 = 1.0 - pow(((((M * (0.5 * D)) / d) * sqrt(0.5)) / sqrt((l / h))), 2.0);
double tmp;
if (d <= -1.35e+52) {
tmp = ((t_3 / sqrt(-h)) * t_0) * t_1;
} else if (d <= 0.0) {
tmp = (t_2 * (t_3 / sqrt(-l))) * t_4;
} else if (d <= 3.8e+19) {
tmp = t_4 * (t_2 * (sqrt(d) / sqrt(l)));
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
}
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) :: t_4
real(8) :: tmp
t_0 = 1.0d0 / sqrt((l / d))
t_1 = 1.0d0 - ((h * (0.5d0 * (((m / 2.0d0) * (d_1 / d)) ** 2.0d0))) / l)
t_2 = (d / h) ** 0.5d0
t_3 = sqrt(-d)
t_4 = 1.0d0 - (((((m * (0.5d0 * d_1)) / d) * sqrt(0.5d0)) / sqrt((l / h))) ** 2.0d0)
if (d <= (-1.35d+52)) then
tmp = ((t_3 / sqrt(-h)) * t_0) * t_1
else if (d <= 0.0d0) then
tmp = (t_2 * (t_3 / sqrt(-l))) * t_4
else if (d <= 3.8d+19) then
tmp = t_4 * (t_2 * (sqrt(d) / sqrt(l)))
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)))
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 = 1.0 / Math.sqrt((l / d));
double t_1 = 1.0 - ((h * (0.5 * Math.pow(((M / 2.0) * (D / d)), 2.0))) / l);
double t_2 = Math.pow((d / h), 0.5);
double t_3 = Math.sqrt(-d);
double t_4 = 1.0 - Math.pow(((((M * (0.5 * D)) / d) * Math.sqrt(0.5)) / Math.sqrt((l / h))), 2.0);
double tmp;
if (d <= -1.35e+52) {
tmp = ((t_3 / Math.sqrt(-h)) * t_0) * t_1;
} else if (d <= 0.0) {
tmp = (t_2 * (t_3 / Math.sqrt(-l))) * t_4;
} else if (d <= 3.8e+19) {
tmp = t_4 * (t_2 * (Math.sqrt(d) / Math.sqrt(l)));
} else {
tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
}
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 = 1.0 / math.sqrt((l / d)) t_1 = 1.0 - ((h * (0.5 * math.pow(((M / 2.0) * (D / d)), 2.0))) / l) t_2 = math.pow((d / h), 0.5) t_3 = math.sqrt(-d) t_4 = 1.0 - math.pow(((((M * (0.5 * D)) / d) * math.sqrt(0.5)) / math.sqrt((l / h))), 2.0) tmp = 0 if d <= -1.35e+52: tmp = ((t_3 / math.sqrt(-h)) * t_0) * t_1 elif d <= 0.0: tmp = (t_2 * (t_3 / math.sqrt(-l))) * t_4 elif d <= 3.8e+19: tmp = t_4 * (t_2 * (math.sqrt(d) / math.sqrt(l))) else: tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(h))) 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 / sqrt(Float64(l / d))) t_1 = Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0))) / l)) t_2 = Float64(d / h) ^ 0.5 t_3 = sqrt(Float64(-d)) t_4 = Float64(1.0 - (Float64(Float64(Float64(Float64(M * Float64(0.5 * D)) / d) * sqrt(0.5)) / sqrt(Float64(l / h))) ^ 2.0)) tmp = 0.0 if (d <= -1.35e+52) tmp = Float64(Float64(Float64(t_3 / sqrt(Float64(-h))) * t_0) * t_1); elseif (d <= 0.0) tmp = Float64(Float64(t_2 * Float64(t_3 / sqrt(Float64(-l)))) * t_4); elseif (d <= 3.8e+19) tmp = Float64(t_4 * Float64(t_2 * Float64(sqrt(d) / sqrt(l)))); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); 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 = 1.0 / sqrt((l / d)); t_1 = 1.0 - ((h * (0.5 * (((M / 2.0) * (D / d)) ^ 2.0))) / l); t_2 = (d / h) ^ 0.5; t_3 = sqrt(-d); t_4 = 1.0 - (((((M * (0.5 * D)) / d) * sqrt(0.5)) / sqrt((l / h))) ^ 2.0); tmp = 0.0; if (d <= -1.35e+52) tmp = ((t_3 / sqrt(-h)) * t_0) * t_1; elseif (d <= 0.0) tmp = (t_2 * (t_3 / sqrt(-l))) * t_4; elseif (d <= 3.8e+19) tmp = t_4 * (t_2 * (sqrt(d) / sqrt(l))); else tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h))); 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[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[Power[N[(N[(N[(N[(M * N[(0.5 * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.35e+52], N[(N[(N[(t$95$3 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 0.0], N[(N[(t$95$2 * N[(t$95$3 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[d, 3.8e+19], N[(t$95$4 * N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $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{1}{\sqrt{\frac{\ell}{d}}}\\
t_1 := 1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\\
t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_3 := \sqrt{-d}\\
t_4 := 1 - {\left(\frac{\frac{M \cdot \left(0.5 \cdot D\right)}{d} \cdot \sqrt{0.5}}{\sqrt{\frac{\ell}{h}}}\right)}^{2}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+52}:\\
\;\;\;\;\left(\frac{t_3}{\sqrt{-h}} \cdot t_0\right) \cdot t_1\\
\mathbf{elif}\;d \leq 0:\\
\;\;\;\;\left(t_2 \cdot \frac{t_3}{\sqrt{-\ell}}\right) \cdot t_4\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{+19}:\\
\;\;\;\;t_4 \cdot \left(t_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\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 d < -1.35e52Initial program 25.8
Applied egg-rr24.7
Applied egg-rr24.2
Applied egg-rr11.8
if -1.35e52 < d < 0.0Initial program 26.3
Applied egg-rr26.0
Applied egg-rr24.0
Applied egg-rr18.1
if 0.0 < d < 3.8e19Initial program 28.9
Applied egg-rr28.7
Applied egg-rr26.0
Applied egg-rr19.7
if 3.8e19 < d Initial program 24.4
Applied egg-rr23.3
Applied egg-rr22.9
Applied egg-rr10.8
Final simplification15.4
herbie shell --seed 2022152
(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)))))