
(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 5 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) NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (/ (* (/ (* 0.5 D) (/ d M_m)) h) l) (* 0.5 (/ D (/ d M_m))))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((((0.5 * D) / (d / M_m)) * h) / l) * (0.5 * (D / (d / M_m))))));
}
M_m = abs(m)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 - (((((0.5d0 * d) / (d_1 / m_m)) * h) / l) * (0.5d0 * (d / (d_1 / m_m))))))
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((((0.5 * D) / (d / M_m)) * h) / l) * (0.5 * (D / (d / M_m))))));
}
M_m = math.fabs(M) [w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d]) def code(w0, M_m, D, h, l, d): return w0 * math.sqrt((1.0 - (((((0.5 * D) / (d / M_m)) * h) / l) * (0.5 * (D / (d / M_m))))))
M_m = abs(M) w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d]) function code(w0, M_m, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.5 * D) / Float64(d / M_m)) * h) / l) * Float64(0.5 * Float64(D / Float64(d / M_m))))))) end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp = code(w0, M_m, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((((0.5 * D) / (d / M_m)) * h) / l) * (0.5 * (D / (d / M_m))))));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(0.5 * D), $MachinePrecision] / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(D / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{\frac{0.5 \cdot D}{\frac{d}{M\_m}} \cdot h}{\ell} \cdot \left(0.5 \cdot \frac{D}{\frac{d}{M\_m}}\right)}
\end{array}
Initial program 81.0%
Simplified81.4%
associate-*r/85.9%
add-sqr-sqrt85.9%
pow285.9%
unpow285.9%
sqrt-prod56.2%
add-sqr-sqrt85.9%
div-inv85.9%
frac-times85.9%
*-commutative85.9%
*-un-lft-identity85.9%
Applied egg-rr85.9%
pow285.9%
associate-*r/81.4%
associate-*l*82.6%
*-commutative82.6%
clear-num82.2%
div-inv82.2%
*-un-lft-identity82.2%
associate-/l*82.2%
times-frac82.2%
metadata-eval82.2%
clear-num82.2%
div-inv82.8%
*-un-lft-identity82.8%
associate-/l*82.8%
times-frac82.8%
metadata-eval82.8%
Applied egg-rr82.8%
associate-*r/88.3%
associate-*r/88.3%
Applied egg-rr88.3%
M_m = (fabs.f64 M) NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D h l d) :precision binary64 (let* ((t_0 (* D (/ M_m (* d 2.0))))) (if (<= (/ h l) -5e-324) (* w0 (sqrt (- 1.0 (* (/ h l) (* t_0 t_0))))) w0)))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
double t_0 = D * (M_m / (d * 2.0));
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * (m_m / (d_1 * 2.0d0))
if ((h / l) <= (-5d-324)) 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);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
double t_0 = D * (M_m / (d * 2.0));
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) [w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d]) def code(w0, M_m, D, h, l, d): t_0 = D * (M_m / (d * 2.0)) tmp = 0 if (h / l) <= -5e-324: tmp = w0 * math.sqrt((1.0 - ((h / l) * (t_0 * t_0)))) else: tmp = w0 return tmp
M_m = abs(M) w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d]) function code(w0, M_m, D, h, l, d) t_0 = Float64(D * Float64(M_m / Float64(d * 2.0))) tmp = 0.0 if (Float64(h / l) <= -5e-324) 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);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
t_0 = D * (M_m / (d * 2.0));
tmp = 0.0;
if ((h / l) <= -5e-324)
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]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -5e-324], 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|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d \cdot 2}\\
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-324}:\\
\;\;\;\;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) < -4.94066e-324Initial program 77.6%
Simplified78.2%
unpow-prod-down65.5%
add-sqr-sqrt65.5%
unpow-prod-down65.5%
unpow265.5%
sqrt-prod41.0%
add-sqr-sqrt54.3%
div-inv54.4%
frac-times54.3%
*-commutative54.3%
*-un-lft-identity54.3%
unpow-prod-down64.4%
unpow264.4%
sqrt-prod51.1%
add-sqr-sqrt78.2%
div-inv78.3%
frac-times78.2%
*-commutative78.2%
*-un-lft-identity78.2%
Applied egg-rr78.2%
if -4.94066e-324 < (/.f64 h l) Initial program 85.8%
Simplified85.8%
Taylor expanded in D around 0 95.6%
Final simplification85.4%
M_m = (fabs.f64 M) NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D h l d) :precision binary64 (let* ((t_0 (* 0.5 (/ D (/ d M_m))))) (if (<= (/ h l) -5e-324) (* w0 (sqrt (- 1.0 (* t_0 (* t_0 (/ h l)))))) w0)))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
double t_0 = 0.5 * (D / (d / M_m));
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (d / (d_1 / m_m))
if ((h / l) <= (-5d-324)) then
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 * (h / l)))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
double t_0 = 0.5 * (D / (d / M_m));
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) [w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d]) def code(w0, M_m, D, h, l, d): t_0 = 0.5 * (D / (d / M_m)) tmp = 0 if (h / l) <= -5e-324: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 * (h / l))))) else: tmp = w0 return tmp
M_m = abs(M) w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d]) function code(w0, M_m, D, h, l, d) t_0 = Float64(0.5 * Float64(D / Float64(d / M_m))) tmp = 0.0 if (Float64(h / l) <= -5e-324) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(h / l)))))); else tmp = w0; end return tmp end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
t_0 = 0.5 * (D / (d / M_m));
tmp = 0.0;
if ((h / l) <= -5e-324)
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := Block[{t$95$0 = N[(0.5 * N[(D / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -5e-324], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{D}{\frac{d}{M\_m}}\\
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-324}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.94066e-324Initial program 77.6%
Simplified78.2%
associate-*r/80.4%
add-sqr-sqrt80.4%
pow280.4%
unpow280.4%
sqrt-prod53.9%
add-sqr-sqrt80.4%
div-inv80.4%
frac-times80.4%
*-commutative80.4%
*-un-lft-identity80.4%
Applied egg-rr80.4%
pow280.4%
associate-*r/78.2%
associate-*l*78.2%
*-commutative78.2%
clear-num77.6%
div-inv77.6%
*-un-lft-identity77.6%
associate-/l*77.6%
times-frac77.6%
metadata-eval77.6%
clear-num77.6%
div-inv77.9%
*-un-lft-identity77.9%
associate-/l*77.9%
times-frac77.9%
metadata-eval77.9%
Applied egg-rr77.9%
if -4.94066e-324 < (/.f64 h l) Initial program 85.8%
Simplified85.8%
Taylor expanded in D around 0 95.6%
Final simplification85.2%
M_m = (fabs.f64 M) NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D h l d) :precision binary64 (if (<= M_m 270000000000.0) w0 (expm1 (* w0 (+ 1.0 (* w0 (- (* w0 0.3333333333333333) 0.5)))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
double tmp;
if (M_m <= 270000000000.0) {
tmp = w0;
} else {
tmp = expm1((w0 * (1.0 + (w0 * ((w0 * 0.3333333333333333) - 0.5)))));
}
return tmp;
}
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
double tmp;
if (M_m <= 270000000000.0) {
tmp = w0;
} else {
tmp = Math.expm1((w0 * (1.0 + (w0 * ((w0 * 0.3333333333333333) - 0.5)))));
}
return tmp;
}
M_m = math.fabs(M) [w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d]) def code(w0, M_m, D, h, l, d): tmp = 0 if M_m <= 270000000000.0: tmp = w0 else: tmp = math.expm1((w0 * (1.0 + (w0 * ((w0 * 0.3333333333333333) - 0.5))))) return tmp
M_m = abs(M) w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d]) function code(w0, M_m, D, h, l, d) tmp = 0.0 if (M_m <= 270000000000.0) tmp = w0; else tmp = expm1(Float64(w0 * Float64(1.0 + Float64(w0 * Float64(Float64(w0 * 0.3333333333333333) - 0.5))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D_, h_, l_, d_] := If[LessEqual[M$95$m, 270000000000.0], w0, N[(Exp[N[(w0 * N[(1.0 + N[(w0 * N[(N[(w0 * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 270000000000:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(w0 \cdot \left(1 + w0 \cdot \left(w0 \cdot 0.3333333333333333 - 0.5\right)\right)\right)\\
\end{array}
\end{array}
if M < 2.7e11Initial program 81.6%
Simplified82.1%
Taylor expanded in D around 0 72.2%
if 2.7e11 < M Initial program 78.4%
Simplified78.5%
unpow-prod-down69.9%
add-sqr-sqrt69.9%
unpow-prod-down69.9%
unpow269.9%
sqrt-prod32.8%
add-sqr-sqrt61.3%
div-inv61.3%
frac-times61.3%
*-commutative61.3%
*-un-lft-identity61.3%
unpow-prod-down69.9%
unpow269.9%
sqrt-prod37.2%
add-sqr-sqrt78.5%
div-inv78.5%
frac-times78.5%
*-commutative78.5%
*-un-lft-identity78.5%
Applied egg-rr78.5%
expm1-log1p-u55.0%
*-commutative55.0%
Applied egg-rr58.1%
Taylor expanded in h around 0 12.0%
log1p-define45.6%
Simplified45.6%
Taylor expanded in w0 around 0 45.0%
Final simplification67.0%
M_m = (fabs.f64 M) NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D h l d) :precision binary64 w0)
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
return w0;
}
M_m = abs(m)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
return w0;
}
M_m = math.fabs(M) [w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d]) def code(w0, M_m, D, h, l, d): return w0
M_m = abs(M) w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d]) function code(w0, M_m, D, h, l, d) return w0 end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp = code(w0, M_m, D, h, l, d)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D_, h_, l_, d_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
w0
\end{array}
Initial program 81.0%
Simplified81.4%
Taylor expanded in D around 0 68.5%
herbie shell --seed 2024178
(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))))))