
(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
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 1.5e+28)
(* w0 (sqrt (- 1.0 (/ (* (pow (* D_m (/ M_m (* 2.0 d_m))) 2.0) h) l))))
(*
w0
(sqrt
(-
1.0
(*
(/ (* D_m (* M_m 0.5)) d_m)
(* 0.5 (* D_m (/ (* h (/ M_m d_m)) 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 (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28) {
tmp = w0 * sqrt((1.0 - ((pow((D_m * (M_m / (2.0 * d_m))), 2.0) * h) / l)));
} else {
tmp = w0 * sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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) :: tmp
if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 1.5d+28) then
tmp = w0 * sqrt((1.0d0 - ((((d_m * (m_m / (2.0d0 * d_m_1))) ** 2.0d0) * h) / l)))
else
tmp = w0 * sqrt((1.0d0 - (((d_m * (m_m * 0.5d0)) / d_m_1) * (0.5d0 * (d_m * ((h * (m_m / d_m_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 tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28) {
tmp = w0 * Math.sqrt((1.0 - ((Math.pow((D_m * (M_m / (2.0 * d_m))), 2.0) * h) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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): tmp = 0 if ((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28: tmp = w0 * math.sqrt((1.0 - ((math.pow((D_m * (M_m / (2.0 * d_m))), 2.0) * h) / l))) else: tmp = w0 * math.sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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(M_m * D_m) / Float64(2.0 * d_m)) <= 1.5e+28) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64((Float64(D_m * Float64(M_m / Float64(2.0 * d_m))) ^ 2.0) * h) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D_m * Float64(M_m * 0.5)) / d_m) * Float64(0.5 * Float64(D_m * Float64(Float64(h * Float64(M_m / d_m)) / 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)
tmp = 0.0;
if (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28)
tmp = w0 * sqrt((1.0 - ((((D_m * (M_m / (2.0 * d_m))) ^ 2.0) * h) / l)));
else
tmp = w0 * sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 1.5e+28], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[Power[N[(D$95$m * N[(M$95$m / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(h * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 1.5 \cdot 10^{+28}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{{\left(D\_m \cdot \frac{M\_m}{2 \cdot d\_m}\right)}^{2} \cdot h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d\_m} \cdot \left(0.5 \cdot \left(D\_m \cdot \frac{h \cdot \frac{M\_m}{d\_m}}{\ell}\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1.5e28Initial program 83.1%
Simplified83.1%
associate-*r/92.8%
add-sqr-sqrt92.8%
pow292.8%
unpow292.8%
sqrt-prod55.2%
add-sqr-sqrt92.8%
div-inv92.8%
frac-times92.8%
*-commutative92.8%
*-un-lft-identity92.8%
Applied egg-rr92.8%
if 1.5e28 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 63.8%
Simplified61.6%
associate-*r/59.5%
add-sqr-sqrt59.5%
pow259.5%
unpow259.5%
sqrt-prod59.4%
add-sqr-sqrt59.5%
div-inv59.5%
frac-times59.5%
*-commutative59.5%
*-un-lft-identity59.5%
Applied egg-rr59.5%
associate-*r/61.6%
unpow261.6%
associate-*l*64.1%
*-commutative64.1%
associate-/r*64.1%
associate-*l/64.1%
div-inv64.1%
metadata-eval64.1%
*-commutative64.1%
associate-/r*64.1%
associate-*l/66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
Taylor expanded in M around 0 64.2%
associate-/l*64.2%
*-commutative64.2%
*-commutative64.2%
times-frac61.8%
Simplified61.8%
associate-*l/64.2%
Applied egg-rr64.2%
Final simplification88.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 (/ (* D_m (* M_m 0.5)) d_m)))
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 1.5e+28)
(* w0 (sqrt (- 1.0 (* h (/ (pow t_0 2.0) l)))))
(* w0 (sqrt (- 1.0 (* t_0 (* 0.5 (* D_m (/ (* h (/ M_m d_m)) 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 = (D_m * (M_m * 0.5)) / d_m;
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28) {
tmp = w0 * sqrt((1.0 - (h * (pow(t_0, 2.0) / l))));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (0.5 * (D_m * ((h * (M_m / d_m)) / 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 = (d_m * (m_m * 0.5d0)) / d_m_1
if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 1.5d+28) then
tmp = w0 * sqrt((1.0d0 - (h * ((t_0 ** 2.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * (0.5d0 * (d_m * ((h * (m_m / d_m_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 = (D_m * (M_m * 0.5)) / d_m;
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow(t_0, 2.0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (0.5 * (D_m * ((h * (M_m / d_m)) / 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 = (D_m * (M_m * 0.5)) / d_m tmp = 0 if ((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28: tmp = w0 * math.sqrt((1.0 - (h * (math.pow(t_0, 2.0) / l)))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * (0.5 * (D_m * ((h * (M_m / d_m)) / 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(D_m * Float64(M_m * 0.5)) / d_m) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 1.5e+28) 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_0 * Float64(0.5 * Float64(D_m * Float64(Float64(h * Float64(M_m / d_m)) / 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 = (D_m * (M_m * 0.5)) / d_m;
tmp = 0.0;
if (((M_m * D_m) / (2.0 * d_m)) <= 1.5e+28)
tmp = w0 * sqrt((1.0 - (h * ((t_0 ^ 2.0) / l))));
else
tmp = w0 * sqrt((1.0 - (t_0 * (0.5 * (D_m * ((h * (M_m / d_m)) / 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[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 1.5e+28], 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$0 * N[(0.5 * N[(D$95$m * N[(N[(h * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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 := \frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d\_m}\\
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 1.5 \cdot 10^{+28}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{t\_0}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(0.5 \cdot \left(D\_m \cdot \frac{h \cdot \frac{M\_m}{d\_m}}{\ell}\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1.5e28Initial program 83.1%
Simplified83.1%
associate-*r/92.8%
add-sqr-sqrt92.8%
pow292.8%
unpow292.8%
sqrt-prod55.2%
add-sqr-sqrt92.8%
div-inv92.8%
frac-times92.8%
*-commutative92.8%
*-un-lft-identity92.8%
Applied egg-rr92.8%
*-commutative92.8%
associate-/l*91.4%
*-commutative91.4%
associate-/r*91.4%
associate-*l/91.5%
div-inv91.5%
metadata-eval91.5%
Applied egg-rr91.5%
if 1.5e28 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 63.8%
Simplified61.6%
associate-*r/59.5%
add-sqr-sqrt59.5%
pow259.5%
unpow259.5%
sqrt-prod59.4%
add-sqr-sqrt59.5%
div-inv59.5%
frac-times59.5%
*-commutative59.5%
*-un-lft-identity59.5%
Applied egg-rr59.5%
associate-*r/61.6%
unpow261.6%
associate-*l*64.1%
*-commutative64.1%
associate-/r*64.1%
associate-*l/64.1%
div-inv64.1%
metadata-eval64.1%
*-commutative64.1%
associate-/r*64.1%
associate-*l/66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
Taylor expanded in M around 0 64.2%
associate-/l*64.2%
*-commutative64.2%
*-commutative64.2%
times-frac61.8%
Simplified61.8%
associate-*l/64.2%
Applied egg-rr64.2%
Final simplification87.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 2e-193)
w0
(*
w0
(sqrt
(-
1.0
(*
(* D_m (/ M_m (* 2.0 d_m)))
(* (/ M_m d_m) (* (/ h l) (* D_m 0.5)))))))))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 <= 2e-193) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((D_m * (M_m / (2.0 * d_m))) * ((M_m / d_m) * ((h / l) * (D_m * 0.5))))));
}
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 <= 2d-193) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((d_m * (m_m / (2.0d0 * d_m_1))) * ((m_m / d_m_1) * ((h / l) * (d_m * 0.5d0))))))
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 <= 2e-193) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((D_m * (M_m / (2.0 * d_m))) * ((M_m / d_m) * ((h / l) * (D_m * 0.5))))));
}
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 <= 2e-193: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((D_m * (M_m / (2.0 * d_m))) * ((M_m / d_m) * ((h / l) * (D_m * 0.5)))))) 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 <= 2e-193) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(D_m * Float64(M_m / Float64(2.0 * d_m))) * Float64(Float64(M_m / d_m) * Float64(Float64(h / l) * Float64(D_m * 0.5))))))); 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 <= 2e-193)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((D_m * (M_m / (2.0 * d_m))) * ((M_m / d_m) * ((h / l) * (D_m * 0.5))))));
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, 2e-193], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(D$95$m * N[(M$95$m / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d$95$m), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;M\_m \leq 2 \cdot 10^{-193}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(D\_m \cdot \frac{M\_m}{2 \cdot d\_m}\right) \cdot \left(\frac{M\_m}{d\_m} \cdot \left(\frac{h}{\ell} \cdot \left(D\_m \cdot 0.5\right)\right)\right)}\\
\end{array}
\end{array}
if M < 2.0000000000000001e-193Initial program 84.1%
Simplified84.1%
Taylor expanded in D around 0 75.4%
if 2.0000000000000001e-193 < M Initial program 73.0%
Simplified72.0%
associate-*r/80.3%
add-sqr-sqrt80.3%
pow280.3%
unpow280.3%
sqrt-prod47.8%
add-sqr-sqrt80.3%
div-inv80.3%
frac-times80.3%
*-commutative80.3%
*-un-lft-identity80.3%
Applied egg-rr80.3%
associate-*r/72.0%
unpow272.0%
associate-*l*73.1%
*-commutative73.1%
associate-/r*73.1%
associate-*l/73.1%
div-inv73.1%
metadata-eval73.1%
*-commutative73.1%
associate-/r*73.1%
associate-*l/74.1%
div-inv74.1%
metadata-eval74.1%
Applied egg-rr74.1%
Taylor expanded in M around 0 76.2%
associate-/l*72.2%
*-commutative72.2%
*-commutative72.2%
times-frac72.1%
Simplified72.1%
*-un-lft-identity72.1%
metadata-eval72.1%
div-inv72.1%
*-commutative72.1%
associate-*l/72.1%
frac-times72.1%
associate-*r*72.1%
Applied egg-rr72.1%
*-lft-identity72.1%
associate-/l*72.1%
*-commutative72.1%
associate-*r*73.1%
*-commutative73.1%
Simplified73.1%
Final simplification74.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
(if (<= D_m 4e-21)
w0
(*
w0
(sqrt
(-
1.0
(*
(/ (* D_m (* M_m 0.5)) d_m)
(* 0.5 (* D_m (* (/ M_m d_m) (/ h 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 (D_m <= 4e-21) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((M_m / d_m) * (h / 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) :: tmp
if (d_m <= 4d-21) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - (((d_m * (m_m * 0.5d0)) / d_m_1) * (0.5d0 * (d_m * ((m_m / d_m_1) * (h / 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 tmp;
if (D_m <= 4e-21) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((M_m / d_m) * (h / 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): tmp = 0 if D_m <= 4e-21: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((M_m / d_m) * (h / 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 (D_m <= 4e-21) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D_m * Float64(M_m * 0.5)) / d_m) * Float64(0.5 * Float64(D_m * Float64(Float64(M_m / d_m) * Float64(h / 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)
tmp = 0.0;
if (D_m <= 4e-21)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((M_m / d_m) * (h / 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_] := If[LessEqual[D$95$m, 4e-21], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(M$95$m / d$95$m), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;D\_m \leq 4 \cdot 10^{-21}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d\_m} \cdot \left(0.5 \cdot \left(D\_m \cdot \left(\frac{M\_m}{d\_m} \cdot \frac{h}{\ell}\right)\right)\right)}\\
\end{array}
\end{array}
if D < 3.99999999999999963e-21Initial program 80.8%
Simplified80.3%
Taylor expanded in D around 0 75.5%
if 3.99999999999999963e-21 < D Initial program 77.0%
Simplified77.0%
associate-*r/78.7%
add-sqr-sqrt78.7%
pow278.7%
unpow278.7%
sqrt-prod43.8%
add-sqr-sqrt78.7%
div-inv78.7%
frac-times78.7%
*-commutative78.7%
*-un-lft-identity78.7%
Applied egg-rr78.7%
associate-*r/77.0%
unpow277.0%
associate-*l*77.2%
*-commutative77.2%
associate-/r*77.2%
associate-*l/77.1%
div-inv77.1%
metadata-eval77.1%
*-commutative77.1%
associate-/r*77.1%
associate-*l/77.1%
div-inv77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in M around 0 76.8%
associate-/l*81.1%
*-commutative81.1%
*-commutative81.1%
times-frac77.1%
Simplified77.1%
Final simplification75.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 (<= M_m 1.9e-52)
w0
(+
w0
(/
(* -0.125 (* (* (* M_m D_m) (* M_m D_m)) (* w0 h)))
(* l (pow d_m 2.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 tmp;
if (M_m <= 1.9e-52) {
tmp = w0;
} else {
tmp = w0 + ((-0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * h))) / (l * pow(d_m, 2.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) :: tmp
if (m_m <= 1.9d-52) then
tmp = w0
else
tmp = w0 + (((-0.125d0) * (((m_m * d_m) * (m_m * d_m)) * (w0 * h))) / (l * (d_m_1 ** 2.0d0)))
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 <= 1.9e-52) {
tmp = w0;
} else {
tmp = w0 + ((-0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * h))) / (l * Math.pow(d_m, 2.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): tmp = 0 if M_m <= 1.9e-52: tmp = w0 else: tmp = w0 + ((-0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * h))) / (l * math.pow(d_m, 2.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) tmp = 0.0 if (M_m <= 1.9e-52) tmp = w0; else tmp = Float64(w0 + Float64(Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(w0 * h))) / Float64(l * (d_m ^ 2.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)
tmp = 0.0;
if (M_m <= 1.9e-52)
tmp = w0;
else
tmp = w0 + ((-0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * h))) / (l * (d_m ^ 2.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_] := If[LessEqual[M$95$m, 1.9e-52], w0, N[(w0 + N[(N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Power[d$95$m, 2.0], $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}\;M\_m \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + \frac{-0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(w0 \cdot h\right)\right)}{\ell \cdot {d\_m}^{2}}\\
\end{array}
\end{array}
if M < 1.9000000000000002e-52Initial program 82.3%
Simplified82.3%
Taylor expanded in D around 0 74.8%
if 1.9000000000000002e-52 < M Initial program 72.4%
Simplified70.8%
add-sqr-sqrt34.4%
sqrt-unprod25.2%
*-commutative25.2%
*-commutative25.2%
swap-sqr20.3%
Applied egg-rr20.3%
Taylor expanded in D around 0 39.7%
associate-*r/39.7%
associate-*r*41.6%
unpow241.6%
unpow241.6%
swap-sqr45.1%
unpow245.1%
Simplified45.1%
unpow245.1%
Applied egg-rr45.1%
Final simplification67.6%
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
(* (/ (* D_m (* M_m 0.5)) d_m) (* 0.5 (* D_m (/ (* h (/ M_m d_m)) 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 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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 - (((d_m * (m_m * 0.5d0)) / d_m_1) * (0.5d0 * (d_m * ((h * (m_m / d_m_1)) / 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 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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(Float64(Float64(D_m * Float64(M_m * 0.5)) / d_m) * Float64(0.5 * Float64(D_m * Float64(Float64(h * Float64(M_m / d_m)) / 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 - (((D_m * (M_m * 0.5)) / d_m) * (0.5 * (D_m * ((h * (M_m / d_m)) / 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[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(h * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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 - \frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d\_m} \cdot \left(0.5 \cdot \left(D\_m \cdot \frac{h \cdot \frac{M\_m}{d\_m}}{\ell}\right)\right)}
\end{array}
Initial program 79.9%
Simplified79.5%
associate-*r/87.3%
add-sqr-sqrt87.3%
pow287.3%
unpow287.3%
sqrt-prod55.9%
add-sqr-sqrt87.3%
div-inv87.3%
frac-times87.3%
*-commutative87.3%
*-un-lft-identity87.3%
Applied egg-rr87.3%
associate-*r/79.5%
unpow279.5%
associate-*l*80.8%
*-commutative80.8%
associate-/r*80.8%
associate-*l/80.4%
div-inv80.4%
metadata-eval80.4%
*-commutative80.4%
associate-/r*80.4%
associate-*l/81.6%
div-inv81.6%
metadata-eval81.6%
Applied egg-rr81.6%
Taylor expanded in M around 0 81.5%
associate-/l*80.4%
*-commutative80.4%
*-commutative80.4%
times-frac79.6%
Simplified79.6%
associate-*l/86.3%
Applied egg-rr86.3%
Final simplification86.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 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 79.9%
Simplified79.5%
Taylor expanded in D around 0 68.6%
Final simplification68.6%
herbie shell --seed 2024080
(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))))))