(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 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))
(t_1 (sqrt (* (/ h l) (* -0.25 (* (/ M d) (/ M d)))))))
(if (<= t_0 (- INFINITY))
(fma D (* t_1 w0) (* 0.5 (/ (/ w0 D) t_1)))
(if (<= t_0 0.0002)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ 0.5 (/ d (* M D))) 2.0)))))
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 = pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double t_1 = sqrt(((h / l) * (-0.25 * ((M / d) * (M / d)))));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(D, (t_1 * w0), (0.5 * ((w0 / D) / t_1)));
} else if (t_0 <= 0.0002) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((0.5 / (d / (M * D))), 2.0))));
} 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 = Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_1 = sqrt(Float64(Float64(h / l) * Float64(-0.25 * Float64(Float64(M / d) * Float64(M / d))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(D, Float64(t_1 * w0), Float64(0.5 * Float64(Float64(w0 / D) / t_1))); elseif (t_0 <= 0.0002) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(0.5 / Float64(d / Float64(M * D))) ^ 2.0))))); 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[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(h / l), $MachinePrecision] * N[(-0.25 * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(D * N[(t$95$1 * w0), $MachinePrecision] + N[(0.5 * N[(N[(w0 / D), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0002], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 / N[(d / N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $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 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := \sqrt{\frac{h}{\ell} \cdot \left(-0.25 \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(D, t_1 \cdot w0, 0.5 \cdot \frac{\frac{w0}{D}}{t_1}\right)\\
\mathbf{elif}\;t_0 \leq 0.0002:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{0.5}{\frac{d}{M \cdot D}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -inf.0Initial program 64.0
Simplified61.3
Taylor expanded in D around inf 56.4
Simplified48.4
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 2.0000000000000001e-4Initial program 0.1
Simplified0.9
Taylor expanded in M around 0 0.1
Simplified0.1
if 2.0000000000000001e-4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 63.2
Taylor expanded in M around 0 16.9
Final simplification7.9
herbie shell --seed 2022197
(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))))))