
(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 (<= (/ (* M_m D_m) (* 2.0 d_m)) 1e+132)
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (/ D_m (* 2.0 d_m))) 2.0) l)))))
(pow
(*
(cbrt w0)
(pow
(exp 0.16666666666666666)
(+
(log (* -0.25 (/ (* h (pow (* M_m D_m) 2.0)) l)))
(* -2.0 (log d_m)))))
3.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 * D_m) / (2.0 * d_m)) <= 1e+132) {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * (D_m / (2.0 * d_m))), 2.0) / l))));
} else {
tmp = pow((cbrt(w0) * pow(exp(0.16666666666666666), (log((-0.25 * ((h * pow((M_m * D_m), 2.0)) / l))) + (-2.0 * log(d_m))))), 3.0);
}
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 * D_m) / (2.0 * d_m)) <= 1e+132) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m / (2.0 * d_m))), 2.0) / l))));
} else {
tmp = Math.pow((Math.cbrt(w0) * Math.pow(Math.exp(0.16666666666666666), (Math.log((-0.25 * ((h * Math.pow((M_m * D_m), 2.0)) / l))) + (-2.0 * Math.log(d_m))))), 3.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 (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 1e+132) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m / Float64(2.0 * d_m))) ^ 2.0) / l))))); else tmp = Float64(cbrt(w0) * (exp(0.16666666666666666) ^ Float64(log(Float64(-0.25 * Float64(Float64(h * (Float64(M_m * D_m) ^ 2.0)) / l))) + Float64(-2.0 * log(d_m))))) ^ 3.0; 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[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 1e+132], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(N[Log[N[(-0.25 * N[(N[(h * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-2.0 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $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 10^{+132}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M\_m \cdot \frac{D\_m}{2 \cdot d\_m}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\log \left(-0.25 \cdot \frac{h \cdot {\left(M\_m \cdot D\_m\right)}^{2}}{\ell}\right) + -2 \cdot \log d\_m\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 9.99999999999999991e131Initial program 82.2%
Simplified81.8%
unpow281.8%
associate-*l*84.0%
associate-/r*84.0%
associate-*r/83.2%
associate-*l/82.6%
*-commutative82.6%
associate-/r*82.6%
associate-*r/82.6%
associate-*l/83.4%
*-commutative83.4%
associate-*l*81.3%
unpow281.3%
expm1-log1p-u68.7%
expm1-undefine68.7%
Applied egg-rr82.2%
associate--l+82.2%
metadata-eval82.2%
+-rgt-identity82.2%
associate-*l/88.0%
associate-/l*87.5%
*-rgt-identity87.5%
times-frac86.7%
/-rgt-identity86.7%
Simplified86.7%
if 9.99999999999999991e131 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 52.4%
Simplified52.4%
unpow252.4%
associate-*l*54.8%
associate-/r*54.8%
associate-*r/52.4%
associate-*l/54.8%
*-commutative54.8%
associate-/r*54.8%
associate-*r/52.4%
associate-*l/54.8%
*-commutative54.8%
associate-*l*52.4%
unpow252.4%
expm1-log1p-u0.0%
expm1-undefine0.0%
Applied egg-rr52.4%
associate--l+52.4%
metadata-eval52.4%
+-rgt-identity52.4%
associate-*l/52.5%
associate-/l*52.5%
*-rgt-identity52.5%
times-frac52.5%
/-rgt-identity52.5%
Simplified52.5%
add-cube-cbrt52.5%
pow352.5%
Applied egg-rr52.5%
Taylor expanded in d around 0 16.2%
exp-prod16.2%
distribute-lft-neg-in16.2%
metadata-eval16.2%
associate-*r*16.3%
unpow216.3%
unpow216.3%
swap-sqr20.2%
unpow220.2%
*-commutative20.2%
Simplified20.2%
Final simplification80.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 (sqrt (- 1.0 (* h (/ (pow (* M_m (/ D_m (* 2.0 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 * (D_m / (2.0 * 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 * (d_m / (2.0d0 * 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 * (D_m / (2.0 * 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 * (D_m / (2.0 * 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(M_m * Float64(D_m / Float64(2.0 * 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 * (D_m / (2.0 * 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[(M$95$m * N[(D$95$m / N[(2.0 * d$95$m), $MachinePrecision]), $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(M\_m \cdot \frac{D\_m}{2 \cdot d\_m}\right)}^{2}}{\ell}}
\end{array}
Initial program 79.1%
Simplified78.8%
unpow278.8%
associate-*l*81.0%
associate-/r*81.0%
associate-*r/80.0%
associate-*l/79.7%
*-commutative79.7%
associate-/r*79.7%
associate-*r/79.5%
associate-*l/80.5%
*-commutative80.5%
associate-*l*78.3%
unpow278.3%
expm1-log1p-u61.7%
expm1-undefine61.7%
Applied egg-rr79.1%
associate--l+79.1%
metadata-eval79.1%
+-rgt-identity79.1%
associate-*l/84.4%
associate-/l*84.0%
*-rgt-identity84.0%
times-frac83.2%
/-rgt-identity83.2%
Simplified83.2%
Final simplification83.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
(if (<= D_m 1.4e+163)
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 (D_m <= 1.4e+163) {
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 (d_m <= 1.4d+163) 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 (D_m <= 1.4e+163) {
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 D_m <= 1.4e+163: 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 (D_m <= 1.4e+163) 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 (D_m <= 1.4e+163)
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[D$95$m, 1.4e+163], 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}\;D\_m \leq 1.4 \cdot 10^{+163}:\\
\;\;\;\;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 D < 1.40000000000000007e163Initial program 80.4%
Simplified80.0%
Taylor expanded in D around 0 70.7%
if 1.40000000000000007e163 < D Initial program 68.2%
Simplified68.2%
Taylor expanded in D around 0 15.2%
associate-*r/15.2%
associate-*r*15.2%
pow-prod-down67.3%
*-commutative67.3%
Applied egg-rr67.3%
unpow267.3%
Applied egg-rr67.3%
Final simplification70.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.1%
Simplified78.8%
Taylor expanded in D around 0 68.1%
herbie shell --seed 2024137
(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))))))