
(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 6 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}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (* (/ (* 0.5 M) d) D) h) (* (/ (* d (/ 2.0 M)) D) l))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (((d * (2.0 / M)) / D) * l))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 - (((((0.5d0 * m) / d_1) * d) * h) / (((d_1 * (2.0d0 / m)) / d) * l))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (((d * (2.0 / M)) / D) * l))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (((d * (2.0 / M)) / D) * l))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.5 * M) / d) * D) * h) / Float64(Float64(Float64(d * Float64(2.0 / M)) / D) * l))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (((d * (2.0 / M)) / D) * l))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{\left(\frac{0.5 \cdot M}{d} \cdot D\right) \cdot h}{\frac{d \cdot \frac{2}{M}}{D} \cdot \ell}}
\end{array}
Initial program 82.5%
Simplified82.3%
*-commutative82.3%
associate-*l/82.5%
associate-*r/81.7%
times-frac82.5%
unpow282.5%
clear-num82.5%
clear-num82.5%
frac-times82.5%
metadata-eval82.5%
times-frac81.3%
times-frac82.1%
Applied egg-rr82.1%
associate-/r*82.1%
associate-/r*82.1%
Simplified82.1%
frac-times90.1%
associate-/r/89.6%
associate-/r/89.6%
metadata-eval89.6%
Applied egg-rr89.6%
associate-*r/90.3%
Applied egg-rr90.3%
Final simplification90.3%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 3.4e-40) w0 (* w0 (sqrt (- 1.0 (/ (* (/ 0.25 (/ d (* M D))) (* D (* M (/ h d)))) l))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 3.4e-40) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - (((0.25 / (d / (M * D))) * (D * (M * (h / d)))) / l)));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= 3.4d-40) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - (((0.25d0 / (d_1 / (m * d))) * (d * (m * (h / d_1)))) / l)))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 3.4e-40) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - (((0.25 / (d / (M * D))) * (D * (M * (h / d)))) / l)));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 3.4e-40: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - (((0.25 / (d / (M * D))) * (D * (M * (h / d)))) / l))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 3.4e-40) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(0.25 / Float64(d / Float64(M * D))) * Float64(D * Float64(M * Float64(h / d)))) / l)))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 3.4e-40)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - (((0.25 / (d / (M * D))) * (D * (M * (h / d)))) / l)));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 3.4e-40], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(0.25 / N[(d / N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D * N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 3.4 \cdot 10^{-40}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{0.25}{\frac{d}{M \cdot D}} \cdot \left(D \cdot \left(M \cdot \frac{h}{d}\right)\right)}{\ell}}\\
\end{array}
\end{array}
if D < 3.39999999999999984e-40Initial program 85.1%
Simplified84.4%
Taylor expanded in D around 0 74.4%
if 3.39999999999999984e-40 < D Initial program 74.0%
Simplified75.7%
*-commutative75.7%
associate-*l/74.0%
associate-*r/69.3%
times-frac74.0%
unpow274.0%
associate-/r*74.0%
frac-times62.3%
div-inv62.3%
*-commutative62.3%
metadata-eval62.3%
associate-*r*62.3%
*-commutative62.3%
Applied egg-rr62.3%
associate-*r/64.4%
times-frac74.7%
*-commutative74.7%
*-commutative74.7%
associate-*l/74.7%
associate-*r/74.7%
*-commutative74.7%
*-commutative74.7%
*-commutative74.7%
Applied egg-rr74.7%
pow174.7%
associate-*l*79.2%
associate-*r*79.2%
associate-/l*76.1%
Applied egg-rr76.1%
unpow176.1%
associate-*r*71.5%
*-commutative71.5%
associate-/r/76.3%
associate-*r/71.5%
associate-*l/76.0%
associate-/r/76.3%
associate-*l/82.4%
associate-*r/79.2%
associate-*l/74.4%
associate-*r*74.4%
*-commutative74.4%
associate-*l*74.4%
associate-*r*74.4%
*-commutative74.4%
associate-*r*76.2%
associate-*r/76.2%
Simplified79.1%
Final simplification75.5%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 6e-203) w0 (* w0 (sqrt (- 1.0 (* (/ 0.25 (/ d (* M D))) (* (* M (/ h d)) (/ D l))))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 6e-203) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((0.25 / (d / (M * D))) * ((M * (h / d)) * (D / l)))));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 6d-203) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((0.25d0 / (d_1 / (m * d))) * ((m * (h / d_1)) * (d / l)))))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 6e-203) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((0.25 / (d / (M * D))) * ((M * (h / d)) * (D / l)))));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 6e-203: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((0.25 / (d / (M * D))) * ((M * (h / d)) * (D / l))))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 6e-203) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 / Float64(d / Float64(M * D))) * Float64(Float64(M * Float64(h / d)) * Float64(D / l)))))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 6e-203)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((0.25 / (d / (M * D))) * ((M * (h / d)) * (D / l)))));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 6e-203], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 / N[(d / N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] * N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6 \cdot 10^{-203}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{\frac{d}{M \cdot D}} \cdot \left(\left(M \cdot \frac{h}{d}\right) \cdot \frac{D}{\ell}\right)}\\
\end{array}
\end{array}
if M < 6.0000000000000002e-203Initial program 85.7%
Simplified86.1%
Taylor expanded in D around 0 74.5%
if 6.0000000000000002e-203 < M Initial program 78.4%
Simplified77.5%
*-commutative77.5%
associate-*l/78.4%
associate-*r/79.2%
times-frac78.4%
unpow278.4%
clear-num78.4%
clear-num78.4%
frac-times78.4%
metadata-eval78.4%
times-frac78.4%
times-frac79.2%
Applied egg-rr79.2%
associate-/r*79.2%
associate-/r*79.2%
Simplified79.2%
frac-times87.2%
associate-/r/86.3%
associate-/r/86.3%
metadata-eval86.3%
Applied egg-rr86.3%
associate-*r/86.3%
Applied egg-rr86.3%
associate-*r/86.3%
frac-times85.5%
associate-/l*85.5%
*-commutative85.5%
associate-*r/85.5%
associate-*r*85.5%
frac-times86.3%
associate-*l*85.4%
Applied egg-rr85.4%
associate-*r/84.5%
associate-*r/84.5%
associate-*l/84.5%
associate-*r*84.5%
*-commutative84.5%
associate-*l*84.5%
associate-*r*84.5%
*-commutative84.5%
associate-*r*83.7%
associate-*r/83.7%
associate-*r*85.5%
*-commutative85.5%
associate-*l/85.2%
associate-/l*85.2%
times-frac84.4%
associate-/l/82.0%
Simplified83.6%
Final simplification78.5%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (* (/ (* 0.5 M) d) D) h) (* l (* (/ 2.0 M) (/ d D))))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (l * ((2.0 / M) * (d / D))))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 - (((((0.5d0 * m) / d_1) * d) * h) / (l * ((2.0d0 / m) * (d_1 / d))))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (l * ((2.0 / M) * (d / D))))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (l * ((2.0 / M) * (d / D))))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.5 * M) / d) * D) * h) / Float64(l * Float64(Float64(2.0 / M) * Float64(d / D))))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((((0.5 * M) / d) * D) * h) / (l * ((2.0 / M) * (d / D))))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision] / N[(l * N[(N[(2.0 / M), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{\left(\frac{0.5 \cdot M}{d} \cdot D\right) \cdot h}{\ell \cdot \left(\frac{2}{M} \cdot \frac{d}{D}\right)}}
\end{array}
Initial program 82.5%
Simplified82.3%
*-commutative82.3%
associate-*l/82.5%
associate-*r/81.7%
times-frac82.5%
unpow282.5%
clear-num82.5%
clear-num82.5%
frac-times82.5%
metadata-eval82.5%
times-frac81.3%
times-frac82.1%
Applied egg-rr82.1%
associate-/r*82.1%
associate-/r*82.1%
Simplified82.1%
frac-times90.1%
associate-/r/89.6%
associate-/r/89.6%
metadata-eval89.6%
Applied egg-rr89.6%
Final simplification89.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* 0.5 (* D (/ (* M h) d))) (* l (* (/ 2.0 M) (/ d D))))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((0.5 * (D * ((M * h) / d))) / (l * ((2.0 / M) * (d / D))))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 - ((0.5d0 * (d * ((m * h) / d_1))) / (l * ((2.0d0 / m) * (d_1 / d))))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((0.5 * (D * ((M * h) / d))) / (l * ((2.0 / M) * (d / D))))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((0.5 * (D * ((M * h) / d))) / (l * ((2.0 / M) * (d / D))))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.5 * Float64(D * Float64(Float64(M * h) / d))) / Float64(l * Float64(Float64(2.0 / M) * Float64(d / D))))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((0.5 * (D * ((M * h) / d))) / (l * ((2.0 / M) * (d / D))))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.5 * N[(D * N[(N[(M * h), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(N[(2.0 / M), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{0.5 \cdot \left(D \cdot \frac{M \cdot h}{d}\right)}{\ell \cdot \left(\frac{2}{M} \cdot \frac{d}{D}\right)}}
\end{array}
Initial program 82.5%
Simplified82.3%
*-commutative82.3%
associate-*l/82.5%
associate-*r/81.7%
times-frac82.5%
unpow282.5%
clear-num82.5%
clear-num82.5%
frac-times82.5%
metadata-eval82.5%
times-frac81.3%
times-frac82.1%
Applied egg-rr82.1%
associate-/r*82.1%
associate-/r*82.1%
Simplified82.1%
frac-times90.1%
associate-/r/89.6%
associate-/r/89.6%
metadata-eval89.6%
Applied egg-rr89.6%
Taylor expanded in M around 0 86.1%
associate-/l*86.5%
Simplified86.5%
Final simplification86.5%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return w0 end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0
\end{array}
Initial program 82.5%
Simplified82.3%
Taylor expanded in D around 0 68.7%
herbie shell --seed 2024151
(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))))))