(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* M D) (* 2.0 d))))
(if (<= t_0 -1.6633635303706548e+143)
(* w0 (* D (sqrt (* (/ (* -0.25 h) l) (* (/ M d) (/ M d))))))
(if (<= t_0 3.6116818720243387e+118)
(*
w0
(sqrt (- 1.0 (/ 1.0 (/ l (* h (pow (* 0.5 (/ (* M D) d)) 2.0)))))))
(* w0 (* (sqrt (* -0.25 (/ D (/ (* l (* d d)) (* D h))))) (- M)))))))double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / (2.0 * d);
double tmp;
if (t_0 <= -1.6633635303706548e+143) {
tmp = w0 * (D * sqrt((((-0.25 * h) / l) * ((M / d) * (M / d)))));
} else if (t_0 <= 3.6116818720243387e+118) {
tmp = w0 * sqrt((1.0 - (1.0 / (l / (h * pow((0.5 * ((M * D) / d)), 2.0))))));
} else {
tmp = w0 * (sqrt((-0.25 * (D / ((l * (d * d)) / (D * h))))) * -M);
}
return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m * d) / (2.0d0 * d_1)
if (t_0 <= (-1.6633635303706548d+143)) then
tmp = w0 * (d * sqrt(((((-0.25d0) * h) / l) * ((m / d_1) * (m / d_1)))))
else if (t_0 <= 3.6116818720243387d+118) then
tmp = w0 * sqrt((1.0d0 - (1.0d0 / (l / (h * ((0.5d0 * ((m * d) / d_1)) ** 2.0d0))))))
else
tmp = w0 * (sqrt(((-0.25d0) * (d / ((l * (d_1 * d_1)) / (d * h))))) * -m)
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / (2.0 * d);
double tmp;
if (t_0 <= -1.6633635303706548e+143) {
tmp = w0 * (D * Math.sqrt((((-0.25 * h) / l) * ((M / d) * (M / d)))));
} else if (t_0 <= 3.6116818720243387e+118) {
tmp = w0 * Math.sqrt((1.0 - (1.0 / (l / (h * Math.pow((0.5 * ((M * D) / d)), 2.0))))));
} else {
tmp = w0 * (Math.sqrt((-0.25 * (D / ((l * (d * d)) / (D * h))))) * -M);
}
return tmp;
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
def code(w0, M, D, h, l, d): t_0 = (M * D) / (2.0 * d) tmp = 0 if t_0 <= -1.6633635303706548e+143: tmp = w0 * (D * math.sqrt((((-0.25 * h) / l) * ((M / d) * (M / d))))) elif t_0 <= 3.6116818720243387e+118: tmp = w0 * math.sqrt((1.0 - (1.0 / (l / (h * math.pow((0.5 * ((M * D) / d)), 2.0)))))) else: tmp = w0 * (math.sqrt((-0.25 * (D / ((l * (d * d)) / (D * h))))) * -M) return tmp
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / Float64(2.0 * d)) tmp = 0.0 if (t_0 <= -1.6633635303706548e+143) tmp = Float64(w0 * Float64(D * sqrt(Float64(Float64(Float64(-0.25 * h) / l) * Float64(Float64(M / d) * Float64(M / d)))))); elseif (t_0 <= 3.6116818720243387e+118) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(1.0 / Float64(l / Float64(h * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))))))); else tmp = Float64(w0 * Float64(sqrt(Float64(-0.25 * Float64(D / Float64(Float64(l * Float64(d * d)) / Float64(D * h))))) * Float64(-M))); end return tmp end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = (M * D) / (2.0 * d); tmp = 0.0; if (t_0 <= -1.6633635303706548e+143) tmp = w0 * (D * sqrt((((-0.25 * h) / l) * ((M / d) * (M / d))))); elseif (t_0 <= 3.6116818720243387e+118) tmp = w0 * sqrt((1.0 - (1.0 / (l / (h * ((0.5 * ((M * D) / d)) ^ 2.0)))))); else tmp = w0 * (sqrt((-0.25 * (D / ((l * (d * d)) / (D * h))))) * -M); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1.6633635303706548e+143], N[(w0 * N[(D * N[Sqrt[N[(N[(N[(-0.25 * h), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 3.6116818720243387e+118], N[(w0 * N[Sqrt[N[(1.0 - N[(1.0 / N[(l / N[(h * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[Sqrt[N[(-0.25 * N[(D / N[(N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(D * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-M)), $MachinePrecision]), $MachinePrecision]]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d}\\
\mathbf{if}\;t_0 \leq -1.6633635303706548 \cdot 10^{+143}:\\
\;\;\;\;w0 \cdot \left(D \cdot \sqrt{\frac{-0.25 \cdot h}{\ell} \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)}\right)\\
\mathbf{elif}\;t_0 \leq 3.6116818720243387 \cdot 10^{+118}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{1}{\frac{\ell}{h \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}}}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(\sqrt{-0.25 \cdot \frac{D}{\frac{\ell \cdot \left(d \cdot d\right)}{D \cdot h}}} \cdot \left(-M\right)\right)\\
\end{array}



Bits error versus w0



Bits error versus M



Bits error versus D



Bits error versus h



Bits error versus l



Bits error versus d
Results
if (/.f64 (*.f64 M D) (*.f64 2 d)) < -1.66336353037065479e143Initial program 61.2
Applied egg-rr59.2
Taylor expanded in M around 0 61.9
Taylor expanded in D around inf 58.1
Simplified50.5
if -1.66336353037065479e143 < (/.f64 (*.f64 M D) (*.f64 2 d)) < 3.6116818720243387e118Initial program 6.8
Applied egg-rr3.5
Taylor expanded in M around 0 3.1
if 3.6116818720243387e118 < (/.f64 (*.f64 M D) (*.f64 2 d)) Initial program 57.1
Applied egg-rr55.8
Taylor expanded in M around 0 57.9
Taylor expanded in M around -inf 56.6
Simplified55.1
Final simplification10.0
herbie shell --seed 2022148
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))