
(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 4 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 (<= (* 2.0 d_m) 2000000.0)
(*
w0
(sqrt
(-
1.0
(/
(* (/ (* M_m (* D_m 0.5)) d_m) h)
(* (/ (* d_m (/ 2.0 M_m)) D_m) l)))))
(*
w0
(sqrt
(-
1.0
(/
(/ (* h (* M_m (/ (* D_m 0.5) d_m))) (* (/ 2.0 M_m) (/ d_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 ((2.0 * d_m) <= 2000000.0) {
tmp = w0 * sqrt((1.0 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (((d_m * (2.0 / M_m)) / D_m) * l))));
} else {
tmp = w0 * sqrt((1.0 - (((h * (M_m * ((D_m * 0.5) / d_m))) / ((2.0 / M_m) * (d_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 ((2.0d0 * d_m_1) <= 2000000.0d0) then
tmp = w0 * sqrt((1.0d0 - ((((m_m * (d_m * 0.5d0)) / d_m_1) * h) / (((d_m_1 * (2.0d0 / m_m)) / d_m) * l))))
else
tmp = w0 * sqrt((1.0d0 - (((h * (m_m * ((d_m * 0.5d0) / d_m_1))) / ((2.0d0 / m_m) * (d_m_1 / d_m))) / 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 ((2.0 * d_m) <= 2000000.0) {
tmp = w0 * Math.sqrt((1.0 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (((d_m * (2.0 / M_m)) / D_m) * l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (((h * (M_m * ((D_m * 0.5) / d_m))) / ((2.0 / M_m) * (d_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 (2.0 * d_m) <= 2000000.0: tmp = w0 * math.sqrt((1.0 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (((d_m * (2.0 / M_m)) / D_m) * l)))) else: tmp = w0 * math.sqrt((1.0 - (((h * (M_m * ((D_m * 0.5) / d_m))) / ((2.0 / M_m) * (d_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(2.0 * d_m) <= 2000000.0) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / d_m) * h) / Float64(Float64(Float64(d_m * Float64(2.0 / M_m)) / D_m) * l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h * Float64(M_m * Float64(Float64(D_m * 0.5) / d_m))) / Float64(Float64(2.0 / M_m) * Float64(d_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 ((2.0 * d_m) <= 2000000.0)
tmp = w0 * sqrt((1.0 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (((d_m * (2.0 / M_m)) / D_m) * l))));
else
tmp = w0 * sqrt((1.0 - (((h * (M_m * ((D_m * 0.5) / d_m))) / ((2.0 / M_m) * (d_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[(2.0 * d$95$m), $MachinePrecision], 2000000.0], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d$95$m * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision] / D$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h * N[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 / M$95$m), $MachinePrecision] * N[(d$95$m / D$95$m), $MachinePrecision]), $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}\;2 \cdot d\_m \leq 2000000:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d\_m} \cdot h}{\frac{d\_m \cdot \frac{2}{M\_m}}{D\_m} \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h \cdot \left(M\_m \cdot \frac{D\_m \cdot 0.5}{d\_m}\right)}{\frac{2}{M\_m} \cdot \frac{d\_m}{D\_m}}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 #s(literal 2 binary64) d) < 2e6Initial program 81.0%
Simplified80.6%
unpow280.6%
*-commutative80.6%
associate-*l/79.9%
associate-*r/79.6%
times-frac79.9%
clear-num79.9%
un-div-inv79.9%
*-commutative79.9%
associate-*l/81.0%
associate-*r/80.0%
times-frac81.0%
associate-/l*80.0%
div-inv80.0%
associate-/r*80.0%
metadata-eval80.0%
times-frac80.7%
Applied egg-rr80.7%
frac-times91.0%
associate-*r/91.0%
associate-*r/89.7%
associate-*r/88.3%
Applied egg-rr88.3%
if 2e6 < (*.f64 #s(literal 2 binary64) d) Initial program 84.9%
Simplified86.1%
unpow286.1%
*-commutative86.1%
associate-*l/84.9%
associate-*r/86.2%
times-frac84.9%
clear-num84.9%
un-div-inv84.9%
*-commutative84.9%
associate-*l/84.9%
associate-*r/84.9%
times-frac84.9%
associate-/l*84.9%
div-inv84.9%
associate-/r*84.9%
metadata-eval84.9%
times-frac86.2%
Applied egg-rr86.2%
associate-*r/90.7%
associate-*r/90.7%
associate-*r/89.5%
associate-*r/89.5%
Applied egg-rr89.5%
associate-*l/90.9%
associate-/l*93.4%
associate-/l*94.6%
Applied egg-rr94.6%
Final simplification90.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 (<= (/ h l) -1.9e-268)
(*
w0
(sqrt
(-
1.0
(*
(* M_m (* D_m (/ 0.5 d_m)))
(/ (/ h l) (* 2.0 (/ (/ d_m D_m) M_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 ((h / l) <= -1.9e-268) {
tmp = w0 * sqrt((1.0 - ((M_m * (D_m * (0.5 / d_m))) * ((h / l) / (2.0 * ((d_m / D_m) / M_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 ((h / l) <= (-1.9d-268)) then
tmp = w0 * sqrt((1.0d0 - ((m_m * (d_m * (0.5d0 / d_m_1))) * ((h / l) / (2.0d0 * ((d_m_1 / d_m) / m_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 ((h / l) <= -1.9e-268) {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (D_m * (0.5 / d_m))) * ((h / l) / (2.0 * ((d_m / D_m) / M_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 (h / l) <= -1.9e-268: tmp = w0 * math.sqrt((1.0 - ((M_m * (D_m * (0.5 / d_m))) * ((h / l) / (2.0 * ((d_m / D_m) / M_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 (Float64(h / l) <= -1.9e-268) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) * Float64(Float64(h / l) / Float64(2.0 * Float64(Float64(d_m / D_m) / M_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 ((h / l) <= -1.9e-268)
tmp = w0 * sqrt((1.0 - ((M_m * (D_m * (0.5 / d_m))) * ((h / l) / (2.0 * ((d_m / D_m) / M_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[N[(h / l), $MachinePrecision], -1.9e-268], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[(2.0 * N[(N[(d$95$m / D$95$m), $MachinePrecision] / M$95$m), $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}\;\frac{h}{\ell} \leq -1.9 \cdot 10^{-268}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d\_m}\right)\right) \cdot \frac{\frac{h}{\ell}}{2 \cdot \frac{\frac{d\_m}{D\_m}}{M\_m}}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.9000000000000001e-268Initial program 78.9%
Simplified79.6%
unpow279.6%
*-commutative79.6%
associate-*l/78.9%
associate-*r/78.5%
times-frac78.9%
clear-num78.9%
un-div-inv78.9%
*-commutative78.9%
associate-*l/78.9%
associate-*r/77.8%
times-frac78.9%
associate-/l*77.8%
div-inv77.8%
associate-/r*77.8%
metadata-eval77.8%
times-frac78.6%
Applied egg-rr78.6%
frac-times88.0%
associate-*r/88.0%
associate-*r/87.7%
associate-*r/86.1%
Applied egg-rr86.1%
times-frac78.9%
associate-*l/81.3%
associate-/l*81.3%
associate-/l*81.5%
associate-/l*81.5%
associate-/l*83.3%
associate-*l/83.3%
associate-/l*83.3%
Simplified83.3%
if -1.9000000000000001e-268 < (/.f64 h l) Initial program 87.4%
Simplified86.3%
Taylor expanded in D around 0 96.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
(*
w0
(sqrt
(-
1.0
(/ (* (/ (* M_m (* D_m 0.5)) d_m) h) (* l (* 2.0 (/ d_m (* M_m D_m)))))))))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 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (l * (2.0 * (d_m / (M_m * D_m)))))));
}
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 - ((((m_m * (d_m * 0.5d0)) / d_m_1) * h) / (l * (2.0d0 * (d_m_1 / (m_m * d_m)))))))
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 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (l * (2.0 * (d_m / (M_m * D_m)))))));
}
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 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (l * (2.0 * (d_m / (M_m * D_m)))))))
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(Float64(M_m * Float64(D_m * 0.5)) / d_m) * h) / Float64(l * Float64(2.0 * Float64(d_m / Float64(M_m * D_m)))))))) 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 - ((((M_m * (D_m * 0.5)) / d_m) * h) / (l * (2.0 * (d_m / (M_m * D_m)))))));
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[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(l * N[(2.0 * N[(d$95$m / N[(M$95$m * D$95$m), $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])\\
\\
w0 \cdot \sqrt{1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d\_m} \cdot h}{\ell \cdot \left(2 \cdot \frac{d\_m}{M\_m \cdot D\_m}\right)}}
\end{array}
Initial program 82.0%
Simplified82.1%
unpow282.1%
*-commutative82.1%
associate-*l/81.3%
associate-*r/81.4%
times-frac81.3%
clear-num81.3%
un-div-inv81.3%
*-commutative81.3%
associate-*l/82.0%
associate-*r/81.3%
times-frac82.0%
associate-/l*81.3%
div-inv81.3%
associate-/r*81.3%
metadata-eval81.3%
times-frac82.2%
Applied egg-rr82.2%
frac-times91.4%
associate-*r/91.4%
associate-*r/90.4%
associate-*r/89.0%
Applied egg-rr89.0%
Taylor expanded in M around 0 91.1%
Final simplification91.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 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.0%
Simplified82.1%
Taylor expanded in D around 0 63.1%
herbie shell --seed 2024182
(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))))))