
(FPCore (w0 M D h l d) :precision binary64 (* 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) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
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
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); 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]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* 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) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
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
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); 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]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0_m = (fabs.f64 w0)
w0_s = (copysign.f64 1 w0)
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))
(*
w0_s
(if (<= t_0 (- INFINITY))
(pow
(*
(sqrt w0_m)
(exp
(*
0.25
(+
(+ (* 2.0 (log M_m)) (log (* -0.25 (/ (/ h l) (pow d 2.0)))))
(* -2.0 (log (/ 1.0 D_m)))))))
2.0)
(if (<= t_0 -4e-15) (* w0_m (sqrt (- 1.0 t_0))) w0_m)))))M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = pow((sqrt(w0_m) * exp((0.25 * (((2.0 * log(M_m)) + log((-0.25 * ((h / l) / pow(d, 2.0))))) + (-2.0 * log((1.0 / D_m))))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = Math.pow((Math.sqrt(w0_m) * Math.exp((0.25 * (((2.0 * Math.log(M_m)) + Math.log((-0.25 * ((h / l) / Math.pow(d, 2.0))))) + (-2.0 * Math.log((1.0 / D_m))))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * Math.sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): t_0 = math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l) tmp = 0 if t_0 <= -math.inf: tmp = math.pow((math.sqrt(w0_m) * math.exp((0.25 * (((2.0 * math.log(M_m)) + math.log((-0.25 * ((h / l) / math.pow(d, 2.0))))) + (-2.0 * math.log((1.0 / D_m))))))), 2.0) elif t_0 <= -4e-15: tmp = w0_m * math.sqrt((1.0 - t_0)) else: tmp = w0_m return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(sqrt(w0_m) * exp(Float64(0.25 * Float64(Float64(Float64(2.0 * log(M_m)) + log(Float64(-0.25 * Float64(Float64(h / l) / (d ^ 2.0))))) + Float64(-2.0 * log(Float64(1.0 / D_m))))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = Float64(w0_m * sqrt(Float64(1.0 - t_0))); else tmp = w0_m; end return Float64(w0_s * tmp) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = (((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l); tmp = 0.0; if (t_0 <= -Inf) tmp = (sqrt(w0_m) * exp((0.25 * (((2.0 * log(M_m)) + log((-0.25 * ((h / l) / (d ^ 2.0))))) + (-2.0 * log((1.0 / D_m))))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = w0_m * sqrt((1.0 - t_0)); else tmp = w0_m; end tmp_2 = w0_s * tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, N[(w0$95$s * If[LessEqual[t$95$0, (-Infinity)], N[Power[N[(N[Sqrt[w0$95$m], $MachinePrecision] * N[Exp[N[(0.25 * N[(N[(N[(2.0 * N[Log[M$95$m], $MachinePrecision]), $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(h / l), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[Log[N[(1.0 / D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[t$95$0, -4e-15], N[(w0$95$m * N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0$95$m]]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
\begin{array}{l}
t_0 := {\left(\frac{M_m \cdot D_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;{\left(\sqrt{w0_m} \cdot e^{0.25 \cdot \left(\left(2 \cdot \log M_m + \log \left(-0.25 \cdot \frac{\frac{h}{\ell}}{{d}^{2}}\right)\right) + -2 \cdot \log \left(\frac{1}{D_m}\right)\right)}\right)}^{2}\\
\mathbf{elif}\;t_0 \leq -4 \cdot 10^{-15}:\\
\;\;\;\;w0_m \cdot \sqrt{1 - t_0}\\
\mathbf{else}:\\
\;\;\;\;w0_m\\
\end{array}
\end{array}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0_m = (fabs.f64 w0)
w0_s = (copysign.f64 1 w0)
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))
(*
w0_s
(if (<= t_0 (- INFINITY))
(pow
(*
(sqrt w0_m)
(exp
(*
0.25
(+
(* -2.0 (log (/ 1.0 D_m)))
(+ (* 2.0 (log M_m)) (log (* -0.25 (/ h (* l (pow d 2.0))))))))))
2.0)
(if (<= t_0 -4e-15) (* w0_m (sqrt (- 1.0 t_0))) w0_m)))))M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = pow((sqrt(w0_m) * exp((0.25 * ((-2.0 * log((1.0 / D_m))) + ((2.0 * log(M_m)) + log((-0.25 * (h / (l * pow(d, 2.0)))))))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = Math.pow((Math.sqrt(w0_m) * Math.exp((0.25 * ((-2.0 * Math.log((1.0 / D_m))) + ((2.0 * Math.log(M_m)) + Math.log((-0.25 * (h / (l * Math.pow(d, 2.0)))))))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * Math.sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): t_0 = math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l) tmp = 0 if t_0 <= -math.inf: tmp = math.pow((math.sqrt(w0_m) * math.exp((0.25 * ((-2.0 * math.log((1.0 / D_m))) + ((2.0 * math.log(M_m)) + math.log((-0.25 * (h / (l * math.pow(d, 2.0)))))))))), 2.0) elif t_0 <= -4e-15: tmp = w0_m * math.sqrt((1.0 - t_0)) else: tmp = w0_m return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(sqrt(w0_m) * exp(Float64(0.25 * Float64(Float64(-2.0 * log(Float64(1.0 / D_m))) + Float64(Float64(2.0 * log(M_m)) + log(Float64(-0.25 * Float64(h / Float64(l * (d ^ 2.0)))))))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = Float64(w0_m * sqrt(Float64(1.0 - t_0))); else tmp = w0_m; end return Float64(w0_s * tmp) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = (((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l); tmp = 0.0; if (t_0 <= -Inf) tmp = (sqrt(w0_m) * exp((0.25 * ((-2.0 * log((1.0 / D_m))) + ((2.0 * log(M_m)) + log((-0.25 * (h / (l * (d ^ 2.0)))))))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = w0_m * sqrt((1.0 - t_0)); else tmp = w0_m; end tmp_2 = w0_s * tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, N[(w0$95$s * If[LessEqual[t$95$0, (-Infinity)], N[Power[N[(N[Sqrt[w0$95$m], $MachinePrecision] * N[Exp[N[(0.25 * N[(N[(-2.0 * N[Log[N[(1.0 / D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * N[Log[M$95$m], $MachinePrecision]), $MachinePrecision] + N[Log[N[(-0.25 * N[(h / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[t$95$0, -4e-15], N[(w0$95$m * N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0$95$m]]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
\begin{array}{l}
t_0 := {\left(\frac{M_m \cdot D_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;{\left(\sqrt{w0_m} \cdot e^{0.25 \cdot \left(-2 \cdot \log \left(\frac{1}{D_m}\right) + \left(2 \cdot \log M_m + \log \left(-0.25 \cdot \frac{h}{\ell \cdot {d}^{2}}\right)\right)\right)}\right)}^{2}\\
\mathbf{elif}\;t_0 \leq -4 \cdot 10^{-15}:\\
\;\;\;\;w0_m \cdot \sqrt{1 - t_0}\\
\mathbf{else}:\\
\;\;\;\;w0_m\\
\end{array}
\end{array}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0_m = (fabs.f64 w0)
w0_s = (copysign.f64 1 w0)
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))
(*
w0_s
(if (<= t_0 (- INFINITY))
(pow
(*
(sqrt w0_m)
(exp
(*
0.25
(+
(+ (log (* -0.25 (/ (pow M_m 2.0) (/ l h)))) (* 2.0 (log D_m)))
(* -2.0 (log d))))))
2.0)
(if (<= t_0 -4e-15) (* w0_m (sqrt (- 1.0 t_0))) w0_m)))))M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = pow((sqrt(w0_m) * exp((0.25 * ((log((-0.25 * (pow(M_m, 2.0) / (l / h)))) + (2.0 * log(D_m))) + (-2.0 * log(d)))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = Math.pow((Math.sqrt(w0_m) * Math.exp((0.25 * ((Math.log((-0.25 * (Math.pow(M_m, 2.0) / (l / h)))) + (2.0 * Math.log(D_m))) + (-2.0 * Math.log(d)))))), 2.0);
} else if (t_0 <= -4e-15) {
tmp = w0_m * Math.sqrt((1.0 - t_0));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): t_0 = math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l) tmp = 0 if t_0 <= -math.inf: tmp = math.pow((math.sqrt(w0_m) * math.exp((0.25 * ((math.log((-0.25 * (math.pow(M_m, 2.0) / (l / h)))) + (2.0 * math.log(D_m))) + (-2.0 * math.log(d)))))), 2.0) elif t_0 <= -4e-15: tmp = w0_m * math.sqrt((1.0 - t_0)) else: tmp = w0_m return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(sqrt(w0_m) * exp(Float64(0.25 * Float64(Float64(log(Float64(-0.25 * Float64((M_m ^ 2.0) / Float64(l / h)))) + Float64(2.0 * log(D_m))) + Float64(-2.0 * log(d)))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = Float64(w0_m * sqrt(Float64(1.0 - t_0))); else tmp = w0_m; end return Float64(w0_s * tmp) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = (((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l); tmp = 0.0; if (t_0 <= -Inf) tmp = (sqrt(w0_m) * exp((0.25 * ((log((-0.25 * ((M_m ^ 2.0) / (l / h)))) + (2.0 * log(D_m))) + (-2.0 * log(d)))))) ^ 2.0; elseif (t_0 <= -4e-15) tmp = w0_m * sqrt((1.0 - t_0)); else tmp = w0_m; end tmp_2 = w0_s * tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, N[(w0$95$s * If[LessEqual[t$95$0, (-Infinity)], N[Power[N[(N[Sqrt[w0$95$m], $MachinePrecision] * N[Exp[N[(0.25 * N[(N[(N[Log[N[(-0.25 * N[(N[Power[M$95$m, 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[D$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[Log[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], If[LessEqual[t$95$0, -4e-15], N[(w0$95$m * N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0$95$m]]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
\begin{array}{l}
t_0 := {\left(\frac{M_m \cdot D_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;{\left(\sqrt{w0_m} \cdot e^{0.25 \cdot \left(\left(\log \left(-0.25 \cdot \frac{{M_m}^{2}}{\frac{\ell}{h}}\right) + 2 \cdot \log D_m\right) + -2 \cdot \log d\right)}\right)}^{2}\\
\mathbf{elif}\;t_0 \leq -4 \cdot 10^{-15}:\\
\;\;\;\;w0_m \cdot \sqrt{1 - t_0}\\
\mathbf{else}:\\
\;\;\;\;w0_m\\
\end{array}
\end{array}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0_m = (fabs.f64 w0)
w0_s = (copysign.f64 1 w0)
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<=
(sqrt (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))
INFINITY)
(* w0_m (sqrt (- 1.0 (* (/ h l) (pow (* D_m (/ M_m (* 2.0 d))) 2.0)))))
w0_m)))M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (sqrt((1.0 - (pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)))) <= ((double) INFINITY)) {
tmp = w0_m * sqrt((1.0 - ((h / l) * pow((D_m * (M_m / (2.0 * d))), 2.0))));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (Math.sqrt((1.0 - (Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)))) <= Double.POSITIVE_INFINITY) {
tmp = w0_m * Math.sqrt((1.0 - ((h / l) * Math.pow((D_m * (M_m / (2.0 * d))), 2.0))));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if math.sqrt((1.0 - (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)))) <= math.inf: tmp = w0_m * math.sqrt((1.0 - ((h / l) * math.pow((D_m * (M_m / (2.0 * d))), 2.0)))) else: tmp = w0_m return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (sqrt(Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))) <= Inf) tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / Float64(2.0 * d))) ^ 2.0))))); else tmp = w0_m; end return Float64(w0_s * tmp) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0; if (sqrt((1.0 - ((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)))) <= Inf) tmp = w0_m * sqrt((1.0 - ((h / l) * ((D_m * (M_m / (2.0 * d))) ^ 2.0)))); else tmp = w0_m; end tmp_2 = w0_s * tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], Infinity], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0$95$m]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;\sqrt{1 - {\left(\frac{M_m \cdot D_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq \infty:\\
\;\;\;\;w0_m \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D_m \cdot \frac{M_m}{2 \cdot d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0_m\\
\end{array}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0_m = (fabs.f64 w0)
w0_s = (copysign.f64 1 w0)
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(let* ((t_0 (sqrt (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))))
(*
w0_s
(if (<= t_0 2e+126)
(* w0_m t_0)
(*
w0_m
(sqrt (- 1.0 (/ (* h (pow (* M_m (* D_m (/ 0.5 d))) 2.0)) l))))))))M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = sqrt((1.0 - (pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_0 <= 2e+126) {
tmp = w0_m * t_0;
} else {
tmp = w0_m * sqrt((1.0 - ((h * pow((M_m * (D_m * (0.5 / d))), 2.0)) / l)));
}
return w0_s * tmp;
}
M_m = abs(M)
D_m = abs(D)
w0_m = abs(w0)
w0_s = copysign(1.0d0, w0)
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 - ((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l))))
if (t_0 <= 2d+126) then
tmp = w0_m * t_0
else
tmp = w0_m * sqrt((1.0d0 - ((h * ((m_m * (d_m * (0.5d0 / d))) ** 2.0d0)) / l)))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double t_0 = Math.sqrt((1.0 - (Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_0 <= 2e+126) {
tmp = w0_m * t_0;
} else {
tmp = w0_m * Math.sqrt((1.0 - ((h * Math.pow((M_m * (D_m * (0.5 / d))), 2.0)) / l)));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): t_0 = math.sqrt((1.0 - (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)))) tmp = 0 if t_0 <= 2e+126: tmp = w0_m * t_0 else: tmp = w0_m * math.sqrt((1.0 - ((h * math.pow((M_m * (D_m * (0.5 / d))), 2.0)) / l))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = sqrt(Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))) tmp = 0.0 if (t_0 <= 2e+126) tmp = Float64(w0_m * t_0); else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(D_m * Float64(0.5 / d))) ^ 2.0)) / l)))); end return Float64(w0_s * tmp) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d) t_0 = sqrt((1.0 - ((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)))); tmp = 0.0; if (t_0 <= 2e+126) tmp = w0_m * t_0; else tmp = w0_m * sqrt((1.0 - ((h * ((M_m * (D_m * (0.5 / d))) ^ 2.0)) / l))); end tmp_2 = w0_s * tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(w0$95$s * If[LessEqual[t$95$0, 2e+126], N[(w0$95$m * t$95$0), $MachinePrecision], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
\begin{array}{l}
t_0 := \sqrt{1 - {\left(\frac{M_m \cdot D_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+126}:\\
\;\;\;\;w0_m \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;w0_m \cdot \sqrt{1 - \frac{h \cdot {\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
\end{array}
M_m = (fabs.f64 M) D_m = (fabs.f64 D) w0_m = (fabs.f64 w0) w0_s = (copysign.f64 1 w0) (FPCore (w0_s w0_m M_m D_m h l d) :precision binary64 (* w0_s (if (<= M_m 1.3e+68) w0_m (log1p (expm1 w0_m)))))
M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 1.3e+68) {
tmp = w0_m;
} else {
tmp = log1p(expm1(w0_m));
}
return w0_s * tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 1.3e+68) {
tmp = w0_m;
} else {
tmp = Math.log1p(Math.expm1(w0_m));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if M_m <= 1.3e+68: tmp = w0_m else: tmp = math.log1p(math.expm1(w0_m)) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 1.3e+68) tmp = w0_m; else tmp = log1p(expm1(w0_m)); end return Float64(w0_s * tmp) end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[M$95$m, 1.3e+68], w0$95$m, N[Log[1 + N[(Exp[w0$95$m] - 1), $MachinePrecision]], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
w0_s \cdot \begin{array}{l}
\mathbf{if}\;M_m \leq 1.3 \cdot 10^{+68}:\\
\;\;\;\;w0_m\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(w0_m\right)\right)\\
\end{array}
\end{array}
M_m = (fabs.f64 M) D_m = (fabs.f64 D) w0_m = (fabs.f64 w0) w0_s = (copysign.f64 1 w0) (FPCore (w0_s w0_m M_m D_m h l d) :precision binary64 (* w0_s w0_m))
M_m = fabs(M);
D_m = fabs(D);
w0_m = fabs(w0);
w0_s = copysign(1.0, w0);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * w0_m;
}
M_m = abs(M)
D_m = abs(D)
w0_m = abs(w0)
w0_s = copysign(1.0d0, w0)
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0_s * w0_m
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0_m = Math.abs(w0);
w0_s = Math.copySign(1.0, w0);
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * w0_m;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0_m = math.fabs(w0) w0_s = math.copysign(1.0, w0) def code(w0_s, w0_m, M_m, D_m, h, l, d): return w0_s * w0_m
M_m = abs(M) D_m = abs(D) w0_m = abs(w0) w0_s = copysign(1.0, w0) function code(w0_s, w0_m, M_m, D_m, h, l, d) return Float64(w0_s * w0_m) end
M_m = abs(M); D_m = abs(D); w0_m = abs(w0); w0_s = sign(w0) * abs(1.0); function tmp = code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = w0_s * w0_m; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0_m = N[Abs[w0], $MachinePrecision]
w0_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * w0$95$m), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0_m = \left|w0\right|
\\
w0_s = \mathsf{copysign}\left(1, w0\right)
\\
w0_s \cdot w0_m
\end{array}
herbie shell --seed 2024008
(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))))))