
(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 8 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}
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(*
w0_s
(if (<= (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)) (- INFINITY))
(pow
(*
(sqrt w0_m)
(pow
(exp 0.25)
(+ (log (* -0.25 (/ (* h (pow (* M D) 2.0)) l))) (* -2.0 (log d_m)))))
2.0)
(* w0_m (sqrt (- 1.0 (/ h (* l (pow (* 2.0 (/ (/ d_m D) M)) 2.0)))))))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if ((pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -((double) INFINITY)) {
tmp = pow((sqrt(w0_m) * pow(exp(0.25), (log((-0.25 * ((h * pow((M * D), 2.0)) / l))) + (-2.0 * log(d_m))))), 2.0);
} else {
tmp = w0_m * sqrt((1.0 - (h / (l * pow((2.0 * ((d_m / D) / M)), 2.0)))));
}
return w0_s * tmp;
}
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -Double.POSITIVE_INFINITY) {
tmp = Math.pow((Math.sqrt(w0_m) * Math.pow(Math.exp(0.25), (Math.log((-0.25 * ((h * Math.pow((M * D), 2.0)) / l))) + (-2.0 * Math.log(d_m))))), 2.0);
} else {
tmp = w0_m * Math.sqrt((1.0 - (h / (l * Math.pow((2.0 * ((d_m / D) / M)), 2.0)))));
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): tmp = 0 if (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -math.inf: tmp = math.pow((math.sqrt(w0_m) * math.pow(math.exp(0.25), (math.log((-0.25 * ((h * math.pow((M * D), 2.0)) / l))) + (-2.0 * math.log(d_m))))), 2.0) else: tmp = w0_m * math.sqrt((1.0 - (h / (l * math.pow((2.0 * ((d_m / D) / M)), 2.0))))) return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= Float64(-Inf)) tmp = Float64(sqrt(w0_m) * (exp(0.25) ^ Float64(log(Float64(-0.25 * Float64(Float64(h * (Float64(M * D) ^ 2.0)) / l))) + Float64(-2.0 * log(d_m))))) ^ 2.0; else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(h / Float64(l * (Float64(2.0 * Float64(Float64(d_m / D) / M)) ^ 2.0)))))); end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = 0.0;
if (((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -Inf)
tmp = (sqrt(w0_m) * (exp(0.25) ^ (log((-0.25 * ((h * ((M * D) ^ 2.0)) / l))) + (-2.0 * log(d_m))))) ^ 2.0;
else
tmp = w0_m * sqrt((1.0 - (h / (l * ((2.0 * ((d_m / D) / M)) ^ 2.0)))));
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[Power[N[(N[Sqrt[w0$95$m], $MachinePrecision] * N[Power[N[Exp[0.25], $MachinePrecision], N[(N[Log[N[(-0.25 * N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-2.0 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(h / N[(l * N[Power[N[(2.0 * N[(N[(d$95$m / D), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
\;\;\;\;{\left(\sqrt{w0\_m} \cdot {\left(e^{0.25}\right)}^{\left(\log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right) + -2 \cdot \log d\_m\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h}{\ell \cdot {\left(2 \cdot \frac{\frac{d\_m}{D}}{M}\right)}^{2}}}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0Initial program 56.8%
Simplified56.8%
associate-*r/59.2%
add-sqr-sqrt59.2%
pow259.2%
sqrt-pow159.2%
metadata-eval59.2%
pow159.2%
*-un-lft-identity59.2%
times-frac59.2%
metadata-eval59.2%
Applied egg-rr59.2%
Taylor expanded in M around 0 47.1%
associate-*r/47.1%
associate-*r*49.1%
unpow249.1%
unpow249.1%
swap-sqr60.0%
unpow260.0%
Simplified60.0%
add-sqr-sqrt34.0%
pow234.0%
associate-/l/33.7%
associate-*r*33.7%
Applied egg-rr33.7%
Taylor expanded in d around 0 11.4%
exp-prod11.4%
distribute-lft-neg-in11.4%
metadata-eval11.4%
associate-*r*11.5%
*-commutative11.5%
unpow211.5%
unpow211.5%
swap-sqr14.6%
unpow214.6%
*-commutative14.6%
*-commutative14.6%
Simplified14.6%
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 91.0%
Simplified89.6%
associate-*r/91.0%
unpow291.0%
clear-num91.0%
clear-num91.0%
frac-times91.0%
metadata-eval91.0%
*-commutative91.0%
associate-/l*90.9%
*-commutative90.9%
associate-/l*90.9%
Applied egg-rr90.9%
frac-times97.2%
*-un-lft-identity97.2%
pow297.2%
associate-*r/97.2%
Applied egg-rr97.2%
*-commutative97.2%
*-commutative97.2%
*-commutative97.2%
associate-*r/97.2%
associate-/r*96.3%
Simplified96.3%
Final simplification78.8%
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)))))
(*
w0_s
(if (<= t_0 1e+246)
(* w0_m (sqrt t_0))
(*
w0_m
(sqrt
(-
1.0
(/ (* h (* M (* (* D 0.5) (* (* M 0.5) (/ D d_m))))) (* d_m l)))))))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double t_0 = 1.0 - (pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 1e+246) {
tmp = w0_m * sqrt(t_0);
} else {
tmp = w0_m * sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
}
return w0_s * tmp;
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((m * d) / (2.0d0 * d_m)) ** 2.0d0) * (h / l))
if (t_0 <= 1d+246) then
tmp = w0_m * sqrt(t_0)
else
tmp = w0_m * sqrt((1.0d0 - ((h * (m * ((d * 0.5d0) * ((m * 0.5d0) * (d / d_m))))) / (d_m * l))))
end if
code = w0_s * tmp
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double t_0 = 1.0 - (Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 1e+246) {
tmp = w0_m * Math.sqrt(t_0);
} else {
tmp = w0_m * Math.sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) tmp = 0 if t_0 <= 1e+246: tmp = w0_m * math.sqrt(t_0) else: tmp = w0_m * math.sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l)))) return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 1e+246) tmp = Float64(w0_m * sqrt(t_0)); else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h * Float64(M * Float64(Float64(D * 0.5) * Float64(Float64(M * 0.5) * Float64(D / d_m))))) / Float64(d_m * l))))); end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
t_0 = 1.0 - ((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 1e+246)
tmp = w0_m * sqrt(t_0);
else
tmp = w0_m * sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(w0$95$s * If[LessEqual[t$95$0, 1e+246], N[(w0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h * N[(M * N[(N[(D * 0.5), $MachinePrecision] * N[(N[(M * 0.5), $MachinePrecision] * N[(D / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell}\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{+246}:\\
\;\;\;\;w0\_m \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h \cdot \left(M \cdot \left(\left(D \cdot 0.5\right) \cdot \left(\left(M \cdot 0.5\right) \cdot \frac{D}{d\_m}\right)\right)\right)}{d\_m \cdot \ell}}\\
\end{array}
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 1.00000000000000007e246Initial program 99.9%
if 1.00000000000000007e246 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 43.6%
Simplified44.9%
unpow244.9%
associate-*r/43.6%
associate-/r*43.6%
associate-*l/43.6%
associate-/l*43.6%
div-inv43.6%
metadata-eval43.6%
*-un-lft-identity43.6%
times-frac43.6%
metadata-eval43.6%
Applied egg-rr43.6%
frac-times66.7%
associate-*l*65.4%
associate-*r*65.4%
Applied egg-rr65.4%
Final simplification89.9%
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(*
w0_s
(if (<= (/ h l) (- INFINITY))
(*
w0_m
(sqrt
(- 1.0 (/ (* h (* M (* (* D 0.5) (* (* M 0.5) (/ D d_m))))) (* d_m l)))))
(if (<= (/ h l) -1e-296)
(*
w0_m
(sqrt
(-
1.0
(* (/ h l) (/ (* (* M (* D 0.5)) (* 0.5 (/ (* M D) d_m))) d_m)))))
w0_m))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0_m * sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
} else if ((h / l) <= -1e-296) {
tmp = w0_m * sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0_m * Math.sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
} else if ((h / l) <= -1e-296) {
tmp = w0_m * Math.sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
} else {
tmp = w0_m;
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): tmp = 0 if (h / l) <= -math.inf: tmp = w0_m * math.sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l)))) elif (h / l) <= -1e-296: tmp = w0_m * math.sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m)))) else: tmp = w0_m return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h * Float64(M * Float64(Float64(D * 0.5) * Float64(Float64(M * 0.5) * Float64(D / d_m))))) / Float64(d_m * l))))); elseif (Float64(h / l) <= -1e-296) tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(Float64(M * Float64(D * 0.5)) * Float64(0.5 * Float64(Float64(M * D) / d_m))) / d_m))))); else tmp = w0_m; end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = 0.0;
if ((h / l) <= -Inf)
tmp = w0_m * sqrt((1.0 - ((h * (M * ((D * 0.5) * ((M * 0.5) * (D / d_m))))) / (d_m * l))));
elseif ((h / l) <= -1e-296)
tmp = w0_m * sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
else
tmp = w0_m;
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h * N[(M * N[(N[(D * 0.5), $MachinePrecision] * N[(N[(M * 0.5), $MachinePrecision] * N[(D / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-296], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(N[(M * N[(D * 0.5), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(N[(M * D), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0$95$m]]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h \cdot \left(M \cdot \left(\left(D \cdot 0.5\right) \cdot \left(\left(M \cdot 0.5\right) \cdot \frac{D}{d\_m}\right)\right)\right)}{d\_m \cdot \ell}}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-296}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h}{\ell} \cdot \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(0.5 \cdot \frac{M \cdot D}{d\_m}\right)}{d\_m}}\\
\mathbf{else}:\\
\;\;\;\;w0\_m\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 39.5%
Simplified39.5%
unpow239.5%
associate-*r/39.5%
associate-/r*39.5%
associate-*l/39.5%
associate-/l*39.5%
div-inv39.5%
metadata-eval39.5%
*-un-lft-identity39.5%
times-frac39.5%
metadata-eval39.5%
Applied egg-rr39.5%
frac-times78.9%
associate-*l*78.9%
associate-*r*78.9%
Applied egg-rr78.9%
if -inf.0 < (/.f64 h l) < -1e-296Initial program 83.7%
Simplified82.3%
unpow282.3%
associate-*r/82.3%
associate-/r*82.3%
associate-*l/82.4%
associate-/l*82.4%
div-inv82.4%
metadata-eval82.4%
*-un-lft-identity82.4%
times-frac82.4%
metadata-eval82.4%
Applied egg-rr82.4%
Taylor expanded in M around 0 83.7%
if -1e-296 < (/.f64 h l) Initial program 90.8%
Simplified89.9%
Taylor expanded in M around 0 98.1%
Final simplification89.5%
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(*
w0_s
(if (<= D 4.5e+60)
w0_m
(*
w0_m
(sqrt
(-
1.0
(* (/ h l) (/ (* (* M (* D 0.5)) (* 0.5 (/ (* M D) d_m))) d_m))))))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 4.5e+60) {
tmp = w0_m;
} else {
tmp = w0_m * sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
}
return w0_s * tmp;
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
real(8) :: tmp
if (d <= 4.5d+60) then
tmp = w0_m
else
tmp = w0_m * sqrt((1.0d0 - ((h / l) * (((m * (d * 0.5d0)) * (0.5d0 * ((m * d) / d_m))) / d_m))))
end if
code = w0_s * tmp
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 4.5e+60) {
tmp = w0_m;
} else {
tmp = w0_m * Math.sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): tmp = 0 if D <= 4.5e+60: tmp = w0_m else: tmp = w0_m * math.sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m)))) return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) tmp = 0.0 if (D <= 4.5e+60) tmp = w0_m; else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(Float64(M * Float64(D * 0.5)) * Float64(0.5 * Float64(Float64(M * D) / d_m))) / d_m))))); end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = 0.0;
if (D <= 4.5e+60)
tmp = w0_m;
else
tmp = w0_m * sqrt((1.0 - ((h / l) * (((M * (D * 0.5)) * (0.5 * ((M * D) / d_m))) / d_m))));
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * If[LessEqual[D, 4.5e+60], w0$95$m, N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(N[(M * N[(D * 0.5), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(N[(M * D), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;D \leq 4.5 \cdot 10^{+60}:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h}{\ell} \cdot \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(0.5 \cdot \frac{M \cdot D}{d\_m}\right)}{d\_m}}\\
\end{array}
\end{array}
if D < 4.50000000000000013e60Initial program 85.0%
Simplified84.6%
Taylor expanded in M around 0 76.5%
if 4.50000000000000013e60 < D Initial program 76.7%
Simplified71.9%
unpow271.9%
associate-*r/71.9%
associate-/r*71.9%
associate-*l/72.0%
associate-/l*72.0%
div-inv72.0%
metadata-eval72.0%
*-un-lft-identity72.0%
times-frac72.0%
metadata-eval72.0%
Applied egg-rr72.0%
Taylor expanded in M around 0 76.7%
Final simplification76.5%
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(*
w0_s
(if (<= M 1.5e-213)
w0_m
(*
w0_m
(sqrt
(-
1.0
(* (* (* M (* D 0.5)) (* M (/ (* D 0.5) d_m))) (/ h (* d_m l)))))))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 1.5e-213) {
tmp = w0_m;
} else {
tmp = w0_m * sqrt((1.0 - (((M * (D * 0.5)) * (M * ((D * 0.5) / d_m))) * (h / (d_m * l)))));
}
return w0_s * tmp;
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
real(8) :: tmp
if (m <= 1.5d-213) then
tmp = w0_m
else
tmp = w0_m * sqrt((1.0d0 - (((m * (d * 0.5d0)) * (m * ((d * 0.5d0) / d_m))) * (h / (d_m * l)))))
end if
code = w0_s * tmp
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 1.5e-213) {
tmp = w0_m;
} else {
tmp = w0_m * Math.sqrt((1.0 - (((M * (D * 0.5)) * (M * ((D * 0.5) / d_m))) * (h / (d_m * l)))));
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): tmp = 0 if M <= 1.5e-213: tmp = w0_m else: tmp = w0_m * math.sqrt((1.0 - (((M * (D * 0.5)) * (M * ((D * 0.5) / d_m))) * (h / (d_m * l))))) return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) tmp = 0.0 if (M <= 1.5e-213) tmp = w0_m; else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(Float64(M * Float64(D * 0.5)) * Float64(M * Float64(Float64(D * 0.5) / d_m))) * Float64(h / Float64(d_m * l)))))); end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = 0.0;
if (M <= 1.5e-213)
tmp = w0_m;
else
tmp = w0_m * sqrt((1.0 - (((M * (D * 0.5)) * (M * ((D * 0.5) / d_m))) * (h / (d_m * l)))));
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * If[LessEqual[M, 1.5e-213], w0$95$m, N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(N[(M * N[(D * 0.5), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(D * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;M \leq 1.5 \cdot 10^{-213}:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \left(\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(M \cdot \frac{D \cdot 0.5}{d\_m}\right)\right) \cdot \frac{h}{d\_m \cdot \ell}}\\
\end{array}
\end{array}
if M < 1.49999999999999993e-213Initial program 87.3%
Simplified86.0%
Taylor expanded in M around 0 78.0%
if 1.49999999999999993e-213 < M Initial program 78.7%
Simplified77.8%
unpow277.8%
associate-*r/77.8%
associate-/r*77.8%
associate-*l/76.9%
associate-/l*76.9%
div-inv76.9%
metadata-eval76.9%
*-un-lft-identity76.9%
times-frac76.9%
metadata-eval76.9%
Applied egg-rr76.9%
frac-times83.4%
associate-*l*81.7%
associate-*r*81.7%
Applied egg-rr81.7%
associate-/l*75.3%
associate-*r*77.1%
associate-*l*77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
d_m = (fabs.f64 d) w0\_m = (fabs.f64 w0) w0\_s = (copysign.f64 #s(literal 1 binary64) w0) NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0_s w0_m M D h l d_m) :precision binary64 (let* ((t_0 (* M (/ (* D 0.5) d_m)))) (* w0_s (* w0_m (sqrt (- 1.0 (/ (* h (* t_0 t_0)) l)))))))
d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double t_0 = M * ((D * 0.5) / d_m);
return w0_s * (w0_m * sqrt((1.0 - ((h * (t_0 * t_0)) / l))));
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
real(8) :: t_0
t_0 = m * ((d * 0.5d0) / d_m)
code = w0_s * (w0_m * sqrt((1.0d0 - ((h * (t_0 * t_0)) / l))))
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double t_0 = M * ((D * 0.5) / d_m);
return w0_s * (w0_m * Math.sqrt((1.0 - ((h * (t_0 * t_0)) / l))));
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): t_0 = M * ((D * 0.5) / d_m) return w0_s * (w0_m * math.sqrt((1.0 - ((h * (t_0 * t_0)) / l))))
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) t_0 = Float64(M * Float64(Float64(D * 0.5) / d_m)) return Float64(w0_s * Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h * Float64(t_0 * t_0)) / l))))) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp = code(w0_s, w0_m, M, D, h, l, d_m)
t_0 = M * ((D * 0.5) / d_m);
tmp = w0_s * (w0_m * sqrt((1.0 - ((h * (t_0 * t_0)) / l))));
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(M * N[(N[(D * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]}, N[(w0$95$s * N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := M \cdot \frac{D \cdot 0.5}{d\_m}\\
w0\_s \cdot \left(w0\_m \cdot \sqrt{1 - \frac{h \cdot \left(t\_0 \cdot t\_0\right)}{\ell}}\right)
\end{array}
\end{array}
Initial program 83.6%
Simplified82.5%
associate-*r/87.9%
add-sqr-sqrt87.9%
pow287.9%
sqrt-pow187.9%
metadata-eval87.9%
pow187.9%
*-un-lft-identity87.9%
times-frac87.9%
metadata-eval87.9%
Applied egg-rr87.9%
unpow287.9%
associate-*r/87.9%
associate-*r/87.9%
Applied egg-rr87.9%
Final simplification87.9%
d_m = (fabs.f64 d)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M D h l d_m)
:precision binary64
(*
w0_s
(if (<= D 5.5e+126)
w0_m
(+
w0_m
(/ (* -0.125 (* (* (* M D) (* M D)) (* h w0_m))) (* l (* d_m d_m)))))))d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 5.5e+126) {
tmp = w0_m;
} else {
tmp = w0_m + ((-0.125 * (((M * D) * (M * D)) * (h * w0_m))) / (l * (d_m * d_m)));
}
return w0_s * tmp;
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
real(8) :: tmp
if (d <= 5.5d+126) then
tmp = w0_m
else
tmp = w0_m + (((-0.125d0) * (((m * d) * (m * d)) * (h * w0_m))) / (l * (d_m * d_m)))
end if
code = w0_s * tmp
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 5.5e+126) {
tmp = w0_m;
} else {
tmp = w0_m + ((-0.125 * (((M * D) * (M * D)) * (h * w0_m))) / (l * (d_m * d_m)));
}
return w0_s * tmp;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): tmp = 0 if D <= 5.5e+126: tmp = w0_m else: tmp = w0_m + ((-0.125 * (((M * D) * (M * D)) * (h * w0_m))) / (l * (d_m * d_m))) return w0_s * tmp
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) tmp = 0.0 if (D <= 5.5e+126) tmp = w0_m; else tmp = Float64(w0_m + Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(h * w0_m))) / Float64(l * Float64(d_m * d_m)))); end return Float64(w0_s * tmp) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp_2 = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = 0.0;
if (D <= 5.5e+126)
tmp = w0_m;
else
tmp = w0_m + ((-0.125 * (((M * D) * (M * D)) * (h * w0_m))) / (l * (d_m * d_m)));
end
tmp_2 = w0_s * tmp;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * If[LessEqual[D, 5.5e+126], w0$95$m, N[(w0$95$m + N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(h * w0$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;D \leq 5.5 \cdot 10^{+126}:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m + \frac{-0.125 \cdot \left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \left(h \cdot w0\_m\right)\right)}{\ell \cdot \left(d\_m \cdot d\_m\right)}\\
\end{array}
\end{array}
if D < 5.5000000000000004e126Initial program 84.3%
Simplified83.5%
Taylor expanded in M around 0 74.8%
if 5.5000000000000004e126 < D Initial program 77.3%
Simplified73.3%
Taylor expanded in M around 0 28.6%
associate-*r/28.6%
associate-*r*28.6%
unpow-prod-down56.9%
*-commutative56.9%
*-commutative56.9%
Applied egg-rr56.9%
*-commutative56.9%
unpow256.9%
Applied egg-rr56.9%
unpow256.9%
Applied egg-rr56.9%
Final simplification73.1%
d_m = (fabs.f64 d) w0\_m = (fabs.f64 w0) w0\_s = (copysign.f64 #s(literal 1 binary64) w0) NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0_s w0_m M D h l d_m) :precision binary64 (* w0_s w0_m))
d_m = fabs(d);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M && M < D && D < h && h < l && l < d_m);
double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
return w0_s * w0_m;
}
d_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m, d, h, l, d_m)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_m
code = w0_s * w0_m
end function
d_m = Math.abs(d);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0_s, double w0_m, double M, double D, double h, double l, double d_m) {
return w0_s * w0_m;
}
d_m = math.fabs(d) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M, D, h, l, d_m] = sort([w0_m, M, D, h, l, d_m]) def code(w0_s, w0_m, M, D, h, l, d_m): return w0_s * w0_m
d_m = abs(d) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M, D, h, l, d_m = sort([w0_m, M, D, h, l, d_m]) function code(w0_s, w0_m, M, D, h, l, d_m) return Float64(w0_s * w0_m) end
d_m = abs(d);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M, D, h, l, d_m = num2cell(sort([w0_m, M, D, h, l, d_m])){:}
function tmp = code(w0_s, w0_m, M, D, h, l, d_m)
tmp = w0_s * w0_m;
end
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]
NOTE: w0_m, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M_, D_, h_, l_, d$95$m_] := N[(w0$95$s * w0$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M, D, h, l, d_m] = \mathsf{sort}([w0_m, M, D, h, l, d_m])\\
\\
w0\_s \cdot w0\_m
\end{array}
Initial program 83.6%
Simplified82.5%
Taylor expanded in M around 0 71.7%
herbie shell --seed 2024123
(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))))))