\[ \begin{array}{c}[M, D] = \mathsf{sort}([M, D])\\ \end{array} \]
Math FPCore C Java Python Julia Wolfram TeX \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot e^{\mathsf{log1p}\left(\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(h \cdot {\left(\frac{M}{d}\right)}^{2}\right)\right) \cdot -0.25\right) \cdot 0.5}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-247}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{D \cdot \frac{M}{d}}{\frac{\ell}{h}}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\]
(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
(if (<= (/ h l) (- INFINITY))
(*
w0
(exp (* (log1p (* (* (* D (/ D l)) (* h (pow (/ M d) 2.0))) -0.25)) 0.5)))
(if (<= (/ h l) -2e-247)
(* w0 (sqrt (- 1.0 (* (/ (/ M d) (/ 4.0 D)) (/ (* D (/ M d)) (/ l h))))))
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 tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 * exp((log1p((((D * (D / l)) * (h * pow((M / d), 2.0))) * -0.25)) * 0.5));
} else if ((h / l) <= -2e-247) {
tmp = w0 * sqrt((1.0 - (((M / d) / (4.0 / D)) * ((D * (M / d)) / (l / h)))));
} else {
tmp = w0;
}
return tmp;
}
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 tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 * Math.exp((Math.log1p((((D * (D / l)) * (h * Math.pow((M / d), 2.0))) * -0.25)) * 0.5));
} else if ((h / l) <= -2e-247) {
tmp = w0 * Math.sqrt((1.0 - (((M / d) / (4.0 / D)) * ((D * (M / d)) / (l / h)))));
} else {
tmp = w0;
}
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):
tmp = 0
if (h / l) <= -math.inf:
tmp = w0 * math.exp((math.log1p((((D * (D / l)) * (h * math.pow((M / d), 2.0))) * -0.25)) * 0.5))
elif (h / l) <= -2e-247:
tmp = w0 * math.sqrt((1.0 - (((M / d) / (4.0 / D)) * ((D * (M / d)) / (l / h)))))
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)
tmp = 0.0
if (Float64(h / l) <= Float64(-Inf))
tmp = Float64(w0 * exp(Float64(log1p(Float64(Float64(Float64(D * Float64(D / l)) * Float64(h * (Float64(M / d) ^ 2.0))) * -0.25)) * 0.5)));
elseif (Float64(h / l) <= -2e-247)
tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M / d) / Float64(4.0 / D)) * Float64(Float64(D * Float64(M / d)) / Float64(l / h))))));
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_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Exp[N[(N[Log[1 + N[(N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(h * N[Power[N[(M / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -2e-247], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M / d), $MachinePrecision] / N[(4.0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $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}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot e^{\mathsf{log1p}\left(\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(h \cdot {\left(\frac{M}{d}\right)}^{2}\right)\right) \cdot -0.25\right) \cdot 0.5}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-247}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M}{d}}{\frac{4}{D}} \cdot \frac{D \cdot \frac{M}{d}}{\frac{\ell}{h}}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}