
(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}
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (let* ((t_0 (* D_m (* M (/ 0.5 d))))) (* w0 (sqrt (- 1.0 (* t_0 (/ (* h t_0) l)))))))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double t_0 = D_m * (M * (0.5 / d));
return w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: t_0
t_0 = d_m * (m * (0.5d0 / d))
code = w0 * sqrt((1.0d0 - (t_0 * ((h * t_0) / l))))
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double t_0 = D_m * (M * (0.5 / d));
return w0 * Math.sqrt((1.0 - (t_0 * ((h * t_0) / l))));
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): t_0 = D_m * (M * (0.5 / d)) return w0 * math.sqrt((1.0 - (t_0 * ((h * t_0) / l))))
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) t_0 = Float64(D_m * Float64(M * Float64(0.5 / d))) return Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h * t_0) / l))))) end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp = code(w0, M, D_m, h, l, d)
t_0 = D_m * (M * (0.5 / d));
tmp = w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(M \cdot \frac{0.5}{d}\right)\\
w0 \cdot \sqrt{1 - t\_0 \cdot \frac{h \cdot t\_0}{\ell}}
\end{array}
\end{array}
Initial program 79.5%
Simplified79.1%
*-commutative79.1%
frac-times79.5%
*-commutative79.5%
associate-*l/85.0%
associate-*l/84.7%
*-commutative84.7%
div-inv84.6%
associate-/r*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
associate-*l/79.1%
unpow279.1%
associate-*r*80.7%
Applied egg-rr80.7%
associate-*l/87.3%
Applied egg-rr87.3%
Final simplification87.3%
D_m = (fabs.f64 D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D_m h l d)
:precision binary64
(let* ((t_0 (* D_m (* M (/ 0.5 d)))))
(if (<= d 2e-143)
(* w0 (sqrt (- 1.0 (* t_0 (* t_0 (/ h l))))))
(*
w0
(sqrt
(-
1.0
(* (* (/ D_m d) (* 0.5 (/ (* h M) l))) (* (/ M 2.0) (/ D_m d)))))))))D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double t_0 = D_m * (M * (0.5 / d));
double tmp;
if (d <= 2e-143) {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
} else {
tmp = w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = d_m * (m * (0.5d0 / d))
if (d <= 2d-143) then
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 * (h / l)))))
else
tmp = w0 * sqrt((1.0d0 - (((d_m / d) * (0.5d0 * ((h * m) / l))) * ((m / 2.0d0) * (d_m / d)))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double t_0 = D_m * (M * (0.5 / d));
double tmp;
if (d <= 2e-143) {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
} else {
tmp = w0 * Math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): t_0 = D_m * (M * (0.5 / d)) tmp = 0 if d <= 2e-143: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 * (h / l))))) else: tmp = w0 * math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d))))) return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) t_0 = Float64(D_m * Float64(M * Float64(0.5 / d))) tmp = 0.0 if (d <= 2e-143) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(h / l)))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D_m / d) * Float64(0.5 * Float64(Float64(h * M) / l))) * Float64(Float64(M / 2.0) * Float64(D_m / d)))))); end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
t_0 = D_m * (M * (0.5 / d));
tmp = 0.0;
if (d <= 2e-143)
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / l)))));
else
tmp = w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, 2e-143], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;d \leq 2 \cdot 10^{-143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot \left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}\\
\end{array}
\end{array}
if d < 1.9999999999999999e-143Initial program 76.5%
Simplified76.5%
*-commutative76.5%
frac-times76.5%
*-commutative76.5%
associate-*l/82.4%
associate-*l/82.3%
*-commutative82.3%
div-inv82.3%
associate-/r*82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-*l/76.5%
unpow276.5%
associate-*r*77.2%
Applied egg-rr77.2%
if 1.9999999999999999e-143 < d Initial program 84.1%
Simplified83.2%
*-commutative83.2%
frac-times84.1%
*-commutative84.1%
associate-*l/89.2%
associate-*l/88.3%
*-commutative88.3%
div-inv88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
associate-*l/83.2%
unpow283.2%
associate-*r*86.2%
Applied egg-rr86.2%
Taylor expanded in h around 0 87.8%
*-commutative87.8%
times-frac86.2%
associate-*l*86.2%
Simplified86.2%
associate-*r*86.1%
clear-num86.1%
un-div-inv86.1%
div-inv86.1%
metadata-eval86.1%
Applied egg-rr86.1%
times-frac88.1%
Simplified88.1%
Final simplification81.4%
D_m = (fabs.f64 D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D_m h l d)
:precision binary64
(if (<= d 1e-143)
(*
w0
(sqrt
(- 1.0 (* (* D_m (* M (/ 0.5 d))) (* (/ h l) (/ D_m (/ d (/ M 2.0))))))))
(*
w0
(sqrt
(-
1.0
(* (* (/ D_m d) (* 0.5 (/ (* h M) l))) (* (/ M 2.0) (/ D_m d))))))))D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1e-143) {
tmp = w0 * sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((h / l) * (D_m / (d / (M / 2.0)))))));
} else {
tmp = w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (d <= 1d-143) then
tmp = w0 * sqrt((1.0d0 - ((d_m * (m * (0.5d0 / d))) * ((h / l) * (d_m / (d / (m / 2.0d0)))))))
else
tmp = w0 * sqrt((1.0d0 - (((d_m / d) * (0.5d0 * ((h * m) / l))) * ((m / 2.0d0) * (d_m / d)))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1e-143) {
tmp = w0 * Math.sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((h / l) * (D_m / (d / (M / 2.0)))))));
} else {
tmp = w0 * Math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): tmp = 0 if d <= 1e-143: tmp = w0 * math.sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((h / l) * (D_m / (d / (M / 2.0))))))) else: tmp = w0 * math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d))))) return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) tmp = 0.0 if (d <= 1e-143) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(D_m * Float64(M * Float64(0.5 / d))) * Float64(Float64(h / l) * Float64(D_m / Float64(d / Float64(M / 2.0)))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D_m / d) * Float64(0.5 * Float64(Float64(h * M) / l))) * Float64(Float64(M / 2.0) * Float64(D_m / d)))))); end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
tmp = 0.0;
if (d <= 1e-143)
tmp = w0 * sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((h / l) * (D_m / (d / (M / 2.0)))))));
else
tmp = w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := If[LessEqual[d, 1e-143], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(D$95$m / N[(d / N[(M / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 10^{-143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(D\_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \left(\frac{h}{\ell} \cdot \frac{D\_m}{\frac{d}{\frac{M}{2}}}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot \left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}\\
\end{array}
\end{array}
if d < 9.9999999999999995e-144Initial program 76.5%
Simplified76.5%
*-commutative76.5%
frac-times76.5%
*-commutative76.5%
associate-*l/82.4%
associate-*l/82.3%
*-commutative82.3%
div-inv82.3%
associate-/r*82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-*l/76.5%
unpow276.5%
associate-*r*77.2%
Applied egg-rr77.2%
associate-*r*74.2%
clear-num74.2%
un-div-inv74.2%
div-inv74.2%
metadata-eval74.2%
Applied egg-rr76.0%
associate-/l*77.3%
associate-/l*77.3%
Simplified77.3%
if 9.9999999999999995e-144 < d Initial program 84.1%
Simplified83.2%
*-commutative83.2%
frac-times84.1%
*-commutative84.1%
associate-*l/89.2%
associate-*l/88.3%
*-commutative88.3%
div-inv88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
associate-*l/83.2%
unpow283.2%
associate-*r*86.2%
Applied egg-rr86.2%
Taylor expanded in h around 0 87.8%
*-commutative87.8%
times-frac86.2%
associate-*l*86.2%
Simplified86.2%
associate-*r*86.1%
clear-num86.1%
un-div-inv86.1%
div-inv86.1%
metadata-eval86.1%
Applied egg-rr86.1%
times-frac88.1%
Simplified88.1%
Final simplification81.4%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (* D_m (* M (/ 0.5 d))) (* (/ D_m d) (* 0.5 (/ (* h M) l))))))))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
return w0 * sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((D_m / d) * (0.5 * ((h * M) / l))))));
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0 * sqrt((1.0d0 - ((d_m * (m * (0.5d0 / d))) * ((d_m / d) * (0.5d0 * ((h * m) / l))))))
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((D_m / d) * (0.5 * ((h * M) / l))))));
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): return w0 * math.sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((D_m / d) * (0.5 * ((h * M) / l))))))
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(D_m * Float64(M * Float64(0.5 / d))) * Float64(Float64(D_m / d) * Float64(0.5 * Float64(Float64(h * M) / l))))))) end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp = code(w0, M, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - ((D_m * (M * (0.5 / d))) * ((D_m / d) * (0.5 * ((h * M) / l))))));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(D\_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h \cdot M}{\ell}\right)\right)}
\end{array}
Initial program 79.5%
Simplified79.1%
*-commutative79.1%
frac-times79.5%
*-commutative79.5%
associate-*l/85.0%
associate-*l/84.7%
*-commutative84.7%
div-inv84.6%
associate-/r*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
associate-*l/79.1%
unpow279.1%
associate-*r*80.7%
Applied egg-rr80.7%
Taylor expanded in h around 0 79.9%
*-commutative79.9%
times-frac79.2%
associate-*l*79.2%
Simplified79.2%
Final simplification79.2%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (* (/ D_m d) (* 0.5 (/ (* h M) l))) (* (/ M 2.0) (/ D_m d)))))))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
return w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0 * sqrt((1.0d0 - (((d_m / d) * (0.5d0 * ((h * m) / l))) * ((m / 2.0d0) * (d_m / d)))))
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): return w0 * math.sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))))
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D_m / d) * Float64(0.5 * Float64(Float64(h * M) / l))) * Float64(Float64(M / 2.0) * Float64(D_m / d)))))) end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp = code(w0, M, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - (((D_m / d) * (0.5 * ((h * M) / l))) * ((M / 2.0) * (D_m / d)))));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(N[(h * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h \cdot M}{\ell}\right)\right) \cdot \left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}
\end{array}
Initial program 79.5%
Simplified79.1%
*-commutative79.1%
frac-times79.5%
*-commutative79.5%
associate-*l/85.0%
associate-*l/84.7%
*-commutative84.7%
div-inv84.6%
associate-/r*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
associate-*l/79.1%
unpow279.1%
associate-*r*80.7%
Applied egg-rr80.7%
Taylor expanded in h around 0 79.9%
*-commutative79.9%
times-frac79.2%
associate-*l*79.2%
Simplified79.2%
associate-*r*78.8%
clear-num78.8%
un-div-inv78.8%
div-inv78.8%
metadata-eval78.8%
Applied egg-rr78.8%
times-frac80.3%
Simplified80.3%
Final simplification80.3%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 w0)
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
return w0;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
return w0;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): return w0
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) return w0 end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp = code(w0, M, D_m, h, l, d)
tmp = w0;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := w0
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
w0
\end{array}
Initial program 79.5%
Simplified79.1%
Taylor expanded in D around 0 68.2%
Final simplification68.2%
herbie shell --seed 2024034
(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))))))