
(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)
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 (/ (* D_m 0.5) d_m))))
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+94)
(* w0 (sqrt (- 1.0 (* h (/ (pow (/ (* D_m (* M_m 0.5)) d_m) 2.0) l)))))
(* w0 (sqrt (- 1.0 (* t_0 (* (/ h l) t_0))))))))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 * ((D_m * 0.5) / d_m);
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+94) {
tmp = w0 * sqrt((1.0 - (h * (pow(((D_m * (M_m * 0.5)) / d_m), 2.0) / l))));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 = m_m * ((d_m * 0.5d0) / d_m_1)
if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 5d+94) then
tmp = w0 * sqrt((1.0d0 - (h * ((((d_m * (m_m * 0.5d0)) / d_m_1) ** 2.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * ((h / l) * t_0))))
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 * ((D_m * 0.5) / d_m);
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+94) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow(((D_m * (M_m * 0.5)) / d_m), 2.0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 * ((D_m * 0.5) / d_m) tmp = 0 if ((M_m * D_m) / (2.0 * d_m)) <= 5e+94: tmp = w0 * math.sqrt((1.0 - (h * (math.pow(((D_m * (M_m * 0.5)) / d_m), 2.0) / l)))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * ((h / l) * t_0)))) 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(M_m * Float64(Float64(D_m * 0.5) / d_m)) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+94) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(Float64(D_m * Float64(M_m * 0.5)) / d_m) ^ 2.0) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * t_0))))); 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 * ((D_m * 0.5) / d_m);
tmp = 0.0;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+94)
tmp = w0 * sqrt((1.0 - (h * ((((D_m * (M_m * 0.5)) / d_m) ^ 2.0) / l))));
else
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
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[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+94], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $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 := M\_m \cdot \frac{D\_m \cdot 0.5}{d\_m}\\
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+94}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(\frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d\_m}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.0000000000000001e94Initial program 87.2%
Simplified85.5%
expm1-log1p-u70.0%
expm1-undefine70.0%
Applied egg-rr85.5%
associate--l+85.5%
metadata-eval85.5%
+-rgt-identity85.5%
*-commutative85.5%
associate-*l/91.3%
associate-/l*90.1%
associate-*r/90.1%
associate-/l*91.8%
*-commutative91.8%
associate-*l*91.8%
*-commutative91.8%
associate-/l*90.5%
Simplified90.5%
associate-*r/91.8%
Applied egg-rr91.8%
if 5.0000000000000001e94 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 44.3%
Simplified48.0%
expm1-log1p-u7.6%
expm1-undefine7.7%
Applied egg-rr48.1%
associate--l+48.0%
metadata-eval48.0%
+-rgt-identity48.0%
*-commutative48.0%
unpow248.0%
associate-*r*64.6%
associate-*r/64.6%
associate-*r/64.6%
Applied egg-rr64.6%
Final simplification89.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 (* M_m (/ (* D_m 0.5) d_m))))
(if (<= (* M_m D_m) 1e+33)
(* w0 (sqrt (- 1.0 (* h (/ (pow (* D_m (/ (* M_m 0.5) d_m)) 2.0) l)))))
(* w0 (sqrt (- 1.0 (* t_0 (* (/ h l) t_0))))))))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 * ((D_m * 0.5) / d_m);
double tmp;
if ((M_m * D_m) <= 1e+33) {
tmp = w0 * sqrt((1.0 - (h * (pow((D_m * ((M_m * 0.5) / d_m)), 2.0) / l))));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 = m_m * ((d_m * 0.5d0) / d_m_1)
if ((m_m * d_m) <= 1d+33) then
tmp = w0 * sqrt((1.0d0 - (h * (((d_m * ((m_m * 0.5d0) / d_m_1)) ** 2.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * ((h / l) * t_0))))
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 * ((D_m * 0.5) / d_m);
double tmp;
if ((M_m * D_m) <= 1e+33) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((D_m * ((M_m * 0.5) / d_m)), 2.0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 * ((D_m * 0.5) / d_m) tmp = 0 if (M_m * D_m) <= 1e+33: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((D_m * ((M_m * 0.5) / d_m)), 2.0) / l)))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * ((h / l) * t_0)))) 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(M_m * Float64(Float64(D_m * 0.5) / d_m)) tmp = 0.0 if (Float64(M_m * D_m) <= 1e+33) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(D_m * Float64(Float64(M_m * 0.5) / d_m)) ^ 2.0) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * t_0))))); 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 * ((D_m * 0.5) / d_m);
tmp = 0.0;
if ((M_m * D_m) <= 1e+33)
tmp = w0 * sqrt((1.0 - (h * (((D_m * ((M_m * 0.5) / d_m)) ^ 2.0) / l))));
else
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
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[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e+33], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(D$95$m * N[(N[(M$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $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 := M\_m \cdot \frac{D\_m \cdot 0.5}{d\_m}\\
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{+33}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(D\_m \cdot \frac{M\_m \cdot 0.5}{d\_m}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 9.9999999999999995e32Initial program 84.0%
Simplified83.1%
expm1-log1p-u67.7%
expm1-undefine67.7%
Applied egg-rr83.1%
associate--l+83.1%
metadata-eval83.1%
+-rgt-identity83.1%
*-commutative83.1%
associate-*l/89.4%
associate-/l*88.0%
associate-*r/88.0%
associate-/l*89.0%
*-commutative89.0%
associate-*l*89.0%
*-commutative89.0%
associate-/l*88.0%
Simplified88.0%
if 9.9999999999999995e32 < (*.f64 M D) Initial program 76.8%
Simplified74.7%
expm1-log1p-u43.1%
expm1-undefine43.1%
Applied egg-rr74.7%
associate--l+74.7%
metadata-eval74.7%
+-rgt-identity74.7%
*-commutative74.7%
unpow274.7%
associate-*r*82.5%
associate-*r/82.5%
associate-*r/82.5%
Applied egg-rr82.5%
Final simplification87.1%
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 (/ (* D_m 0.5) d_m)))) (if (<= (/ h l) -1e-321) (* w0 (sqrt (- 1.0 (* t_0 (* (/ h l) 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 = M_m * ((D_m * 0.5) / d_m);
double tmp;
if ((h / l) <= -1e-321) {
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
} else {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = m_m * ((d_m * 0.5d0) / d_m_1)
if ((h / l) <= (-1d-321)) then
tmp = w0 * sqrt((1.0d0 - (t_0 * ((h / l) * t_0))))
else
tmp = 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 t_0 = M_m * ((D_m * 0.5) / d_m);
double tmp;
if ((h / l) <= -1e-321) {
tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h / l) * t_0))));
} else {
tmp = 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): t_0 = M_m * ((D_m * 0.5) / d_m) tmp = 0 if (h / l) <= -1e-321: tmp = w0 * math.sqrt((1.0 - (t_0 * ((h / l) * 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(M_m * Float64(Float64(D_m * 0.5) / d_m)) tmp = 0.0 if (Float64(h / l) <= -1e-321) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * t_0))))); else tmp = 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)
t_0 = M_m * ((D_m * 0.5) / d_m);
tmp = 0.0;
if ((h / l) <= -1e-321)
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
else
tmp = 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_] := Block[{t$95$0 = N[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -1e-321], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $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 := M\_m \cdot \frac{D\_m \cdot 0.5}{d\_m}\\
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-321}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.98013e-322Initial program 77.1%
Simplified77.2%
expm1-log1p-u46.0%
expm1-undefine46.0%
Applied egg-rr77.2%
associate--l+77.2%
metadata-eval77.2%
+-rgt-identity77.2%
*-commutative77.2%
unpow277.2%
associate-*r*78.1%
associate-*r/78.1%
associate-*r/78.1%
Applied egg-rr78.1%
if -9.98013e-322 < (/.f64 h l) Initial program 90.7%
Simplified87.9%
Taylor expanded in M around 0 99.4%
Taylor expanded in w0 around 0 99.4%
Final simplification87.1%
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 (* D_m (/ 0.5 d_m))))) (if (<= (/ h l) -1e-255) (* w0 (sqrt (- 1.0 (* (/ h l) (* t_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 = M_m * (D_m * (0.5 / d_m));
double tmp;
if ((h / l) <= -1e-255) {
tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = m_m * (d_m * (0.5d0 / d_m_1))
if ((h / l) <= (-1d-255)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (t_0 * t_0))))
else
tmp = 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 t_0 = M_m * (D_m * (0.5 / d_m));
double tmp;
if ((h / l) <= -1e-255) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = 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): t_0 = M_m * (D_m * (0.5 / d_m)) tmp = 0 if (h / l) <= -1e-255: tmp = w0 * math.sqrt((1.0 - ((h / l) * (t_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(M_m * Float64(D_m * Float64(0.5 / d_m))) tmp = 0.0 if (Float64(h / l) <= -1e-255) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(t_0 * t_0))))); else tmp = 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)
t_0 = M_m * (D_m * (0.5 / d_m));
tmp = 0.0;
if ((h / l) <= -1e-255)
tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_0))));
else
tmp = 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_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -1e-255], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $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 := M\_m \cdot \left(D\_m \cdot \frac{0.5}{d\_m}\right)\\
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-255}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(t\_0 \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1e-255Initial program 77.5%
Simplified76.9%
unpow-prod-down60.0%
add-sqr-sqrt59.9%
unpow-prod-down60.0%
sqrt-pow148.0%
metadata-eval48.0%
unpow-prod-down48.0%
pow148.0%
div-inv48.0%
pow148.0%
associate-/r*48.0%
metadata-eval48.0%
unpow-prod-down58.8%
sqrt-pow176.9%
metadata-eval76.9%
unpow-prod-down76.9%
pow176.9%
div-inv76.9%
pow176.9%
associate-/r*76.9%
metadata-eval76.9%
Applied egg-rr76.9%
if -1e-255 < (/.f64 h l) Initial program 89.1%
Simplified87.4%
Taylor expanded in M around 0 97.0%
Taylor expanded in w0 around 0 97.0%
Final simplification86.2%
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 (/ (* D_m 0.5) d_m))))
(if (<= M_m 6.5e-120)
(*
w0
(sqrt
(-
1.0
(/
(* h (* M_m (* D_m 0.5)))
(* l (* 2.0 (* d_m (/ (/ d_m M_m) D_m))))))))
(* w0 (sqrt (- 1.0 (* t_0 (* (/ h l) t_0))))))))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 * ((D_m * 0.5) / d_m);
double tmp;
if (M_m <= 6.5e-120) {
tmp = w0 * sqrt((1.0 - ((h * (M_m * (D_m * 0.5))) / (l * (2.0 * (d_m * ((d_m / M_m) / D_m)))))));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 = m_m * ((d_m * 0.5d0) / d_m_1)
if (m_m <= 6.5d-120) then
tmp = w0 * sqrt((1.0d0 - ((h * (m_m * (d_m * 0.5d0))) / (l * (2.0d0 * (d_m_1 * ((d_m_1 / m_m) / d_m)))))))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * ((h / l) * t_0))))
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 * ((D_m * 0.5) / d_m);
double tmp;
if (M_m <= 6.5e-120) {
tmp = w0 * Math.sqrt((1.0 - ((h * (M_m * (D_m * 0.5))) / (l * (2.0 * (d_m * ((d_m / M_m) / D_m)))))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h / l) * t_0))));
}
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 * ((D_m * 0.5) / d_m) tmp = 0 if M_m <= 6.5e-120: tmp = w0 * math.sqrt((1.0 - ((h * (M_m * (D_m * 0.5))) / (l * (2.0 * (d_m * ((d_m / M_m) / D_m))))))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * ((h / l) * t_0)))) 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(M_m * Float64(Float64(D_m * 0.5) / d_m)) tmp = 0.0 if (M_m <= 6.5e-120) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / Float64(l * Float64(2.0 * Float64(d_m * Float64(Float64(d_m / M_m) / D_m)))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * t_0))))); 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 * ((D_m * 0.5) / d_m);
tmp = 0.0;
if (M_m <= 6.5e-120)
tmp = w0 * sqrt((1.0 - ((h * (M_m * (D_m * 0.5))) / (l * (2.0 * (d_m * ((d_m / M_m) / D_m)))))));
else
tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
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[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.5e-120], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(2.0 * N[(d$95$m * N[(N[(d$95$m / M$95$m), $MachinePrecision] / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $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 := M\_m \cdot \frac{D\_m \cdot 0.5}{d\_m}\\
\mathbf{if}\;M\_m \leq 6.5 \cdot 10^{-120}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{\ell \cdot \left(2 \cdot \left(d\_m \cdot \frac{\frac{d\_m}{M\_m}}{D\_m}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)}\\
\end{array}
\end{array}
if M < 6.50000000000000029e-120Initial program 85.4%
Simplified82.5%
associate-*r/85.4%
unpow285.4%
associate-/r*85.4%
clear-num85.4%
frac-times85.4%
*-un-lft-identity85.4%
associate-/l*85.4%
div-inv85.4%
metadata-eval85.4%
associate-/l*85.4%
Applied egg-rr85.4%
frac-times89.0%
associate-*l*89.0%
associate-/r*88.4%
Applied egg-rr88.4%
if 6.50000000000000029e-120 < M Initial program 78.1%
Simplified80.3%
expm1-log1p-u59.1%
expm1-undefine59.1%
Applied egg-rr80.3%
associate--l+80.3%
metadata-eval80.3%
+-rgt-identity80.3%
*-commutative80.3%
unpow280.3%
associate-*r*84.0%
associate-*r/84.0%
associate-*r/84.0%
Applied egg-rr84.0%
Final simplification86.9%
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 (<= d_m 6.6e+59)
(*
w0
(sqrt
(-
1.0
(*
(/ h l)
(/ (* M_m (* D_m 0.5)) (* d_m (* 2.0 (/ d_m (* M_m D_m)))))))))
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 (d_m <= 6.6e+59) {
tmp = w0 * sqrt((1.0 - ((h / l) * ((M_m * (D_m * 0.5)) / (d_m * (2.0 * (d_m / (M_m * D_m))))))));
} else {
tmp = 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 (d_m_1 <= 6.6d+59) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m_m * (d_m * 0.5d0)) / (d_m_1 * (2.0d0 * (d_m_1 / (m_m * d_m))))))))
else
tmp = 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 (d_m <= 6.6e+59) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * ((M_m * (D_m * 0.5)) / (d_m * (2.0 * (d_m / (M_m * D_m))))))));
} else {
tmp = 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 d_m <= 6.6e+59: tmp = w0 * math.sqrt((1.0 - ((h / l) * ((M_m * (D_m * 0.5)) / (d_m * (2.0 * (d_m / (M_m * D_m)))))))) 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) tmp = 0.0 if (d_m <= 6.6e+59) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d_m * Float64(2.0 * Float64(d_m / Float64(M_m * D_m))))))))); else tmp = 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 (d_m <= 6.6e+59)
tmp = w0 * sqrt((1.0 - ((h / l) * ((M_m * (D_m * 0.5)) / (d_m * (2.0 * (d_m / (M_m * D_m))))))));
else
tmp = 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[d$95$m, 6.6e+59], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * N[(2.0 * N[(d$95$m / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;d\_m \leq 6.6 \cdot 10^{+59}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d\_m \cdot \left(2 \cdot \frac{d\_m}{M\_m \cdot D\_m}\right)}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 6.5999999999999999e59Initial program 84.0%
Simplified82.0%
associate-*r/84.0%
unpow284.0%
associate-/r*84.0%
clear-num84.0%
frac-times84.0%
*-un-lft-identity84.0%
associate-/l*84.0%
div-inv84.0%
metadata-eval84.0%
associate-/l*84.0%
Applied egg-rr84.0%
if 6.5999999999999999e59 < d Initial program 79.2%
Simplified80.8%
Taylor expanded in M around 0 89.6%
Taylor expanded in w0 around 0 89.6%
Final simplification85.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 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 82.9%
Simplified81.7%
Taylor expanded in M around 0 72.0%
Taylor expanded in w0 around 0 72.0%
herbie shell --seed 2024111
(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))))))