(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 (sqrt (* (/ h l) (* -0.25 (* (/ M d) (/ M d))))))
(t_1 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))
(if (<= t_1 -5e+303)
(fma D (* t_0 w0) (* 0.5 (/ (/ w0 D) t_0)))
(if (<= t_1 0.0002) (* w0 (sqrt (- 1.0 t_1))) w0))))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 = sqrt(((h / l) * (-0.25 * ((M / d) * (M / d)))));
double t_1 = pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_1 <= -5e+303) {
tmp = fma(D, (t_0 * w0), (0.5 * ((w0 / D) / t_0)));
} else if (t_1 <= 0.0002) {
tmp = w0 * sqrt((1.0 - t_1));
} else {
tmp = w0;
}
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 = sqrt(Float64(Float64(h / l) * Float64(-0.25 * Float64(Float64(M / d) * Float64(M / d))))) t_1 = Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_1 <= -5e+303) tmp = fma(D, Float64(t_0 * w0), Float64(0.5 * Float64(Float64(w0 / D) / t_0))); elseif (t_1 <= 0.0002) tmp = Float64(w0 * sqrt(Float64(1.0 - t_1))); else tmp = w0; end return 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[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(-0.25 * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+303], N[(D * N[(t$95$0 * w0), $MachinePrecision] + N[(0.5 * N[(N[(w0 / D), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0002], N[(w0 * N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell} \cdot \left(-0.25 \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)}\\
t_1 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+303}:\\
\;\;\;\;\mathsf{fma}\left(D, t_0 \cdot w0, 0.5 \cdot \frac{\frac{w0}{D}}{t_0}\right)\\
\mathbf{elif}\;t_1 \leq 0.0002:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_1}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\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
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.9999999999999997e303Initial program 63.6
Simplified61.4
Taylor expanded in D around inf 55.5
Simplified46.8
if -4.9999999999999997e303 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 2.0000000000000001e-4Initial program 0.1
if 2.0000000000000001e-4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 63.1
Simplified60.2
Taylor expanded in M around 0 16.2
Final simplification7.8
herbie shell --seed 2022178
(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))))))