
(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 11 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)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+88)
(pow
(*
(cbrt w0)
(exp
(*
0.16666666666666666
(+
(+ (* -2.0 (log d_m)) (+ (log (* (/ h l) -0.25)) (* 2.0 (log M_m))))
(* -2.0 (log (/ 1.0 D_m)))))))
3.0)
(* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ (* M_m D_m) d_m)) 2.0)) l))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+88) {
tmp = pow((cbrt(w0) * exp((0.16666666666666666 * (((-2.0 * log(d_m)) + (log(((h / l) * -0.25)) + (2.0 * log(M_m)))) + (-2.0 * log((1.0 / D_m))))))), 3.0);
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((0.5 * ((M_m * D_m) / d_m)), 2.0)) / l)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+88) {
tmp = Math.pow((Math.cbrt(w0) * Math.exp((0.16666666666666666 * (((-2.0 * Math.log(d_m)) + (Math.log(((h / l) * -0.25)) + (2.0 * Math.log(M_m)))) + (-2.0 * Math.log((1.0 / D_m))))))), 3.0);
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * ((M_m * D_m) / d_m)), 2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+88) tmp = Float64(cbrt(w0) * exp(Float64(0.16666666666666666 * Float64(Float64(Float64(-2.0 * log(d_m)) + Float64(log(Float64(Float64(h / l) * -0.25)) + Float64(2.0 * log(M_m)))) + Float64(-2.0 * log(Float64(1.0 / D_m))))))) ^ 3.0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(Float64(M_m * D_m) / d_m)) ^ 2.0)) / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+88], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Exp[N[(0.16666666666666666 * N[(N[(N[(-2.0 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(N[(h / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] + N[(2.0 * N[Log[M$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[Log[N[(1.0 / D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+88}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot e^{0.16666666666666666 \cdot \left(\left(-2 \cdot \log d\_m + \left(\log \left(\frac{h}{\ell} \cdot -0.25\right) + 2 \cdot \log M\_m\right)\right) + -2 \cdot \log \left(\frac{1}{D\_m}\right)\right)}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{M\_m \cdot D\_m}{d\_m}\right)}^{2}}{\ell}}\\
\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)) < -4.99999999999999997e88Initial program 65.5%
Simplified67.9%
add-cube-cbrt67.6%
pow367.6%
Applied egg-rr67.6%
Taylor expanded in D around inf 23.7%
Taylor expanded in d around 0 8.1%
+-commutative8.1%
distribute-lft-neg-in8.1%
metadata-eval8.1%
associate-/l*9.2%
Simplified9.2%
Taylor expanded in M around 0 6.9%
if -4.99999999999999997e88 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 91.5%
Simplified90.9%
associate-*r/96.7%
add-sqr-sqrt96.7%
pow296.7%
sqrt-pow196.7%
metadata-eval96.7%
pow196.7%
*-un-lft-identity96.7%
times-frac96.7%
metadata-eval96.7%
Applied egg-rr96.7%
Taylor expanded in M around 0 97.2%
Final simplification69.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+88)
(pow
(*
(cbrt w0)
(exp
(*
0.16666666666666666
(+
(log (* (/ h l) -0.25))
(+
(* -2.0 (log d_m))
(+ (* 2.0 (log M_m)) (* -2.0 (log (/ 1.0 D_m)))))))))
3.0)
(* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ (* M_m D_m) d_m)) 2.0)) l))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+88) {
tmp = pow((cbrt(w0) * exp((0.16666666666666666 * (log(((h / l) * -0.25)) + ((-2.0 * log(d_m)) + ((2.0 * log(M_m)) + (-2.0 * log((1.0 / D_m))))))))), 3.0);
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((0.5 * ((M_m * D_m) / d_m)), 2.0)) / l)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+88) {
tmp = Math.pow((Math.cbrt(w0) * Math.exp((0.16666666666666666 * (Math.log(((h / l) * -0.25)) + ((-2.0 * Math.log(d_m)) + ((2.0 * Math.log(M_m)) + (-2.0 * Math.log((1.0 / D_m))))))))), 3.0);
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * ((M_m * D_m) / d_m)), 2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+88) tmp = Float64(cbrt(w0) * exp(Float64(0.16666666666666666 * Float64(log(Float64(Float64(h / l) * -0.25)) + Float64(Float64(-2.0 * log(d_m)) + Float64(Float64(2.0 * log(M_m)) + Float64(-2.0 * log(Float64(1.0 / D_m))))))))) ^ 3.0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(Float64(M_m * D_m) / d_m)) ^ 2.0)) / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+88], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Exp[N[(0.16666666666666666 * N[(N[Log[N[(N[(h / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] + N[(N[(-2.0 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * N[Log[M$95$m], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[Log[N[(1.0 / D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+88}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot e^{0.16666666666666666 \cdot \left(\log \left(\frac{h}{\ell} \cdot -0.25\right) + \left(-2 \cdot \log d\_m + \left(2 \cdot \log M\_m + -2 \cdot \log \left(\frac{1}{D\_m}\right)\right)\right)\right)}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{M\_m \cdot D\_m}{d\_m}\right)}^{2}}{\ell}}\\
\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)) < -4.99999999999999997e88Initial program 65.5%
Simplified67.9%
add-cube-cbrt67.6%
pow367.6%
Applied egg-rr67.6%
Taylor expanded in D around inf 23.7%
Taylor expanded in d around 0 8.1%
+-commutative8.1%
distribute-lft-neg-in8.1%
metadata-eval8.1%
associate-/l*9.2%
Simplified9.2%
Taylor expanded in M around 0 6.8%
if -4.99999999999999997e88 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 91.5%
Simplified90.9%
associate-*r/96.7%
add-sqr-sqrt96.7%
pow296.7%
sqrt-pow196.7%
metadata-eval96.7%
pow196.7%
*-un-lft-identity96.7%
times-frac96.7%
metadata-eval96.7%
Applied egg-rr96.7%
Taylor expanded in M around 0 97.2%
Final simplification69.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l))))
(if (<= t_0 (- INFINITY))
(pow
(*
(cbrt w0)
(exp
(*
0.16666666666666666
(+
(* -2.0 (log (/ 1.0 D_m)))
(+ (* -2.0 (log d_m)) (log (* -0.25 (* (/ h l) (pow M_m 2.0)))))))))
3.0)
(if (<= t_0 0.02) (* w0 (sqrt (- 1.0 t_0))) w0))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = pow((cbrt(w0) * exp((0.16666666666666666 * ((-2.0 * log((1.0 / D_m))) + ((-2.0 * log(d_m)) + log((-0.25 * ((h / l) * pow(M_m, 2.0))))))))), 3.0);
} else if (t_0 <= 0.02) {
tmp = w0 * sqrt((1.0 - t_0));
} else {
tmp = w0;
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = Math.pow((Math.cbrt(w0) * Math.exp((0.16666666666666666 * ((-2.0 * Math.log((1.0 / D_m))) + ((-2.0 * Math.log(d_m)) + Math.log((-0.25 * ((h / l) * Math.pow(M_m, 2.0))))))))), 3.0);
} else if (t_0 <= 0.02) {
tmp = w0 * Math.sqrt((1.0 - t_0));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(cbrt(w0) * exp(Float64(0.16666666666666666 * Float64(Float64(-2.0 * log(Float64(1.0 / D_m))) + Float64(Float64(-2.0 * log(d_m)) + log(Float64(-0.25 * Float64(Float64(h / l) * (M_m ^ 2.0))))))))) ^ 3.0; elseif (t_0 <= 0.02) tmp = Float64(w0 * sqrt(Float64(1.0 - t_0))); else tmp = w0; end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Exp[N[(0.16666666666666666 * N[(N[(-2.0 * N[Log[N[(1.0 / D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(-2.0 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(h / l), $MachinePrecision] * N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], If[LessEqual[t$95$0, 0.02], N[(w0 * N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot e^{0.16666666666666666 \cdot \left(-2 \cdot \log \left(\frac{1}{D\_m}\right) + \left(-2 \cdot \log d\_m + \log \left(-0.25 \cdot \left(\frac{h}{\ell} \cdot {M\_m}^{2}\right)\right)\right)\right)}\right)}^{3}\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\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 55.7%
Simplified58.8%
add-cube-cbrt58.7%
pow358.7%
Applied egg-rr58.7%
Taylor expanded in D around inf 25.9%
Taylor expanded in d around 0 8.8%
+-commutative8.8%
distribute-lft-neg-in8.8%
metadata-eval8.8%
associate-/l*8.8%
Simplified8.8%
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < 0.0200000000000000004Initial program 99.9%
if 0.0200000000000000004 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 0.0%
Simplified0.0%
Taylor expanded in M around 0 75.0%
Final simplification76.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)))))
(if (<= t_0 1e+304)
(* w0 (sqrt t_0))
(* w0 (sqrt (- 1.0 (* h (/ (pow (* (* M_m 0.5) (/ D_m d_m)) 2.0) l))))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 1.0 - (pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 1e+304) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (h * (pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0) * (h / l))
if (t_0 <= 1d+304) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (h * ((((m_m * 0.5d0) * (d_m / d_m_1)) ** 2.0d0) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 1.0 - (Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 1e+304) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): t_0 = 1.0 - (math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) tmp = 0 if t_0 <= 1e+304: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 1e+304) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(Float64(M_m * 0.5) * Float64(D_m / d_m)) ^ 2.0) / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
t_0 = 1.0 - ((((M_m * D_m) / (2.0 * d_m)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 1e+304)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - (h * ((((M_m * 0.5) * (D_m / d_m)) ^ 2.0) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+304], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 10^{+304}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(\left(M\_m \cdot 0.5\right) \cdot \frac{D\_m}{d\_m}\right)}^{2}}{\ell}}\\
\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))) < 9.9999999999999994e303Initial program 99.9%
if 9.9999999999999994e303 < (-.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 44.8%
Simplified47.3%
associate-*r/61.7%
add-sqr-sqrt61.7%
pow261.7%
sqrt-pow161.7%
metadata-eval61.7%
pow161.7%
*-un-lft-identity61.7%
times-frac61.7%
metadata-eval61.7%
Applied egg-rr61.7%
Applied egg-rr47.3%
*-lft-identity47.3%
*-commutative47.3%
associate-*l/61.7%
associate-*r/61.7%
Simplified61.7%
Final simplification88.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)))))
(if (<= t_0 5e+294)
(* w0 (sqrt t_0))
(* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (* 0.5 (/ D_m d_m))) 2.0)) l)))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 1.0 - (pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+294) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+294) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * (0.5d0 * (d_m / d_m_1))) ** 2.0d0)) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 1.0 - (Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+294) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): t_0 = 1.0 - (math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+294: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+294) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) ^ 2.0)) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
t_0 = 1.0 - ((((M_m * D_m) / (2.0 * d_m)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 5e+294)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - ((h * ((M_m * (0.5 * (D_m / d_m))) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+294], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right)}^{2}}{\ell}}\\
\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))) < 4.9999999999999999e294Initial program 99.9%
if 4.9999999999999999e294 < (-.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 46.2%
Simplified48.6%
associate-*r/62.7%
add-sqr-sqrt62.7%
pow262.7%
sqrt-pow162.7%
metadata-eval62.7%
pow162.7%
*-un-lft-identity62.7%
times-frac62.7%
metadata-eval62.7%
Applied egg-rr62.7%
Final simplification88.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (* (* M_m 0.5) (/ D_m d_m))) (t_1 (* t_0 (sqrt h))))
(if (<= h -5e-310)
(* w0 (sqrt (- 1.0 (* h (/ (pow t_0 2.0) l)))))
(* w0 (sqrt (- 1.0 (* t_1 (/ t_1 l))))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * 0.5) * (D_m / d_m);
double t_1 = t_0 * sqrt(h);
double tmp;
if (h <= -5e-310) {
tmp = w0 * sqrt((1.0 - (h * (pow(t_0, 2.0) / l))));
} else {
tmp = w0 * sqrt((1.0 - (t_1 * (t_1 / l))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (m_m * 0.5d0) * (d_m / d_m_1)
t_1 = t_0 * sqrt(h)
if (h <= (-5d-310)) then
tmp = w0 * sqrt((1.0d0 - (h * ((t_0 ** 2.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (t_1 * (t_1 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * 0.5) * (D_m / d_m);
double t_1 = t_0 * Math.sqrt(h);
double tmp;
if (h <= -5e-310) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow(t_0, 2.0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_1 * (t_1 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): t_0 = (M_m * 0.5) * (D_m / d_m) t_1 = t_0 * math.sqrt(h) tmp = 0 if h <= -5e-310: tmp = w0 * math.sqrt((1.0 - (h * (math.pow(t_0, 2.0) / l)))) else: tmp = w0 * math.sqrt((1.0 - (t_1 * (t_1 / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(M_m * 0.5) * Float64(D_m / d_m)) t_1 = Float64(t_0 * sqrt(h)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((t_0 ^ 2.0) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_1 * Float64(t_1 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
t_0 = (M_m * 0.5) * (D_m / d_m);
t_1 = t_0 * sqrt(h);
tmp = 0.0;
if (h <= -5e-310)
tmp = w0 * sqrt((1.0 - (h * ((t_0 ^ 2.0) / l))));
else
tmp = w0 * sqrt((1.0 - (t_1 * (t_1 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * 0.5), $MachinePrecision] * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot 0.5\right) \cdot \frac{D\_m}{d\_m}\\
t_1 := t\_0 \cdot \sqrt{h}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{t\_0}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_1 \cdot \frac{t\_1}{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 87.4%
Simplified87.4%
associate-*r/89.0%
add-sqr-sqrt89.0%
pow289.0%
sqrt-pow189.0%
metadata-eval89.0%
pow189.0%
*-un-lft-identity89.0%
times-frac89.0%
metadata-eval89.0%
Applied egg-rr89.0%
Applied egg-rr87.4%
*-lft-identity87.4%
*-commutative87.4%
associate-*l/89.0%
associate-*r/90.5%
Simplified90.5%
if -4.999999999999985e-310 < h Initial program 79.2%
Simplified79.9%
associate-*r/83.2%
add-sqr-sqrt83.2%
pow283.2%
sqrt-pow183.2%
metadata-eval83.2%
pow183.2%
*-un-lft-identity83.2%
times-frac83.2%
metadata-eval83.2%
Applied egg-rr83.2%
add-sqr-sqrt83.2%
*-un-lft-identity83.2%
times-frac83.2%
sqrt-prod83.2%
sqrt-pow173.6%
metadata-eval73.6%
pow173.6%
associate-*r*73.6%
sqrt-prod74.3%
sqrt-pow188.5%
metadata-eval88.5%
pow188.5%
associate-*r*88.5%
Applied egg-rr88.5%
Final simplification89.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (pow (* (* M_m 0.5) (/ D_m d_m)) 2.0) l))))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l))));
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
code = w0 * sqrt((1.0d0 - (h * ((((m_m * 0.5d0) * (d_m / d_m_1)) ** 2.0d0) / l))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (Math.pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l))));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (math.pow(((M_m * 0.5) * (D_m / d_m)), 2.0) / l))))
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(Float64(M_m * 0.5) * Float64(D_m / d_m)) ^ 2.0) / l))))) end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp = code(w0, M_m, D_m, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * ((((M_m * 0.5) * (D_m / d_m)) ^ 2.0) / l))));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(\left(M\_m \cdot 0.5\right) \cdot \frac{D\_m}{d\_m}\right)}^{2}}{\ell}}
\end{array}
Initial program 83.4%
Simplified83.7%
associate-*r/86.2%
add-sqr-sqrt86.2%
pow286.2%
sqrt-pow186.2%
metadata-eval86.2%
pow186.2%
*-un-lft-identity86.2%
times-frac86.2%
metadata-eval86.2%
Applied egg-rr86.2%
Applied egg-rr83.7%
*-lft-identity83.7%
*-commutative83.7%
associate-*l/86.2%
associate-*r/87.3%
Simplified87.3%
Final simplification87.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= M_m 7.2e-42) w0 (log (exp w0))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 7.2e-42) {
tmp = w0;
} else {
tmp = log(exp(w0));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
real(8) :: tmp
if (m_m <= 7.2d-42) then
tmp = w0
else
tmp = log(exp(w0))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 7.2e-42) {
tmp = w0;
} else {
tmp = Math.log(Math.exp(w0));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if M_m <= 7.2e-42: tmp = w0 else: tmp = math.log(math.exp(w0)) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (M_m <= 7.2e-42) tmp = w0; else tmp = log(exp(w0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if (M_m <= 7.2e-42)
tmp = w0;
else
tmp = log(exp(w0));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[M$95$m, 7.2e-42], w0, N[Log[N[Exp[w0], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 7.2 \cdot 10^{-42}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{w0}\right)\\
\end{array}
\end{array}
if M < 7.2000000000000004e-42Initial program 85.5%
Simplified86.0%
Taylor expanded in M around 0 73.1%
if 7.2000000000000004e-42 < M Initial program 76.6%
Simplified76.6%
add-sqr-sqrt39.1%
sqrt-unprod31.0%
*-commutative31.0%
*-commutative31.0%
swap-sqr29.2%
Applied egg-rr29.2%
*-commutative29.2%
associate-*r*29.2%
associate-*r/29.2%
*-commutative29.2%
associate-*r/27.6%
associate-*r/27.5%
Simplified27.5%
Taylor expanded in h around 0 25.1%
sqrt-pow150.8%
metadata-eval50.8%
pow150.8%
add-log-exp27.4%
Applied egg-rr27.4%
Final simplification62.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= M_m 1e-63) w0 (log1p (expm1 w0))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 1e-63) {
tmp = w0;
} else {
tmp = log1p(expm1(w0));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 1e-63) {
tmp = w0;
} else {
tmp = Math.log1p(Math.expm1(w0));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if M_m <= 1e-63: tmp = w0 else: tmp = math.log1p(math.expm1(w0)) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (M_m <= 1e-63) tmp = w0; else tmp = log1p(expm1(w0)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[M$95$m, 1e-63], w0, N[Log[1 + N[(Exp[w0] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 10^{-63}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(w0\right)\right)\\
\end{array}
\end{array}
if M < 1.00000000000000007e-63Initial program 85.0%
Simplified85.5%
Taylor expanded in M around 0 72.7%
if 1.00000000000000007e-63 < M Initial program 78.7%
Simplified78.7%
add-sqr-sqrt40.1%
sqrt-unprod28.7%
*-commutative28.7%
*-commutative28.7%
swap-sqr27.1%
Applied egg-rr27.1%
*-commutative27.1%
associate-*r*27.1%
associate-*r/27.1%
*-commutative27.1%
associate-*r/25.5%
associate-*r/25.5%
Simplified25.5%
Taylor expanded in h around 0 23.3%
sqrt-pow153.8%
metadata-eval53.8%
pow153.8%
add-exp-log21.4%
Applied egg-rr21.4%
rem-exp-log53.8%
log1p-expm1-u54.2%
Applied egg-rr54.2%
Final simplification67.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= M_m 7.2e-30) w0 (/ (+ (pow (+ w0 1.0) 2.0) -1.0) (+ 2.0 w0))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 7.2e-30) {
tmp = w0;
} else {
tmp = (pow((w0 + 1.0), 2.0) + -1.0) / (2.0 + w0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
real(8) :: tmp
if (m_m <= 7.2d-30) then
tmp = w0
else
tmp = (((w0 + 1.0d0) ** 2.0d0) + (-1.0d0)) / (2.0d0 + w0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (M_m <= 7.2e-30) {
tmp = w0;
} else {
tmp = (Math.pow((w0 + 1.0), 2.0) + -1.0) / (2.0 + w0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if M_m <= 7.2e-30: tmp = w0 else: tmp = (math.pow((w0 + 1.0), 2.0) + -1.0) / (2.0 + w0) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (M_m <= 7.2e-30) tmp = w0; else tmp = Float64(Float64((Float64(w0 + 1.0) ^ 2.0) + -1.0) / Float64(2.0 + w0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if (M_m <= 7.2e-30)
tmp = w0;
else
tmp = (((w0 + 1.0) ^ 2.0) + -1.0) / (2.0 + w0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[M$95$m, 7.2e-30], w0, N[(N[(N[Power[N[(w0 + 1.0), $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision] / N[(2.0 + w0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 7.2 \cdot 10^{-30}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(w0 + 1\right)}^{2} + -1}{2 + w0}\\
\end{array}
\end{array}
if M < 7.2000000000000006e-30Initial program 85.5%
Simplified86.0%
Taylor expanded in M around 0 73.1%
if 7.2000000000000006e-30 < M Initial program 76.6%
Simplified76.6%
add-sqr-sqrt39.1%
sqrt-unprod31.0%
*-commutative31.0%
*-commutative31.0%
swap-sqr29.2%
Applied egg-rr29.2%
*-commutative29.2%
associate-*r*29.2%
associate-*r/29.2%
*-commutative29.2%
associate-*r/27.6%
associate-*r/27.5%
Simplified27.5%
Taylor expanded in h around 0 25.1%
sqrt-pow150.8%
metadata-eval50.8%
pow150.8%
add-exp-log20.6%
Applied egg-rr20.6%
rem-exp-log50.8%
expm1-log1p-u36.8%
expm1-define9.7%
flip--17.9%
pow217.9%
log1p-undefine17.9%
rem-exp-log17.9%
metadata-eval17.9%
log1p-undefine17.9%
rem-exp-log27.3%
Applied egg-rr27.3%
sub-neg27.3%
metadata-eval27.3%
+-commutative27.3%
associate-+r+27.3%
metadata-eval27.3%
Simplified27.3%
Final simplification62.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
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_m_1
code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): return w0
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return w0 end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp = code(w0, M_m, D_m, h, l, d_m)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0
\end{array}
Initial program 83.4%
Simplified83.7%
Taylor expanded in M around 0 67.7%
Final simplification67.7%
herbie shell --seed 2024082
(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))))))