
(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)
d_m = (fabs.f64 d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M D_m h l d_m)
:precision binary64
(if (<= (* (pow (/ (* M D_m) (* 2.0 d_m)) 2.0) (/ h l)) -1e+247)
(* w0 (/ (sqrt (* -0.25 (/ (* h (pow (* M D_m) 2.0)) l))) d_m))
(*
w0
(sqrt
(-
1.0
(* h (* (* (* D_m 0.5) (/ M d_m)) (/ (* D_m (* 0.5 (/ M d_m))) l))))))))D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
double tmp;
if ((pow(((M * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -1e+247) {
tmp = w0 * (sqrt((-0.25 * ((h * pow((M * D_m), 2.0)) / l))) / d_m);
} else {
tmp = w0 * sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
}
return tmp;
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if (((((m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0) * (h / l)) <= (-1d+247)) then
tmp = w0 * (sqrt(((-0.25d0) * ((h * ((m * d_m) ** 2.0d0)) / l))) / d_m_1)
else
tmp = w0 * sqrt((1.0d0 - (h * (((d_m * 0.5d0) * (m / d_m_1)) * ((d_m * (0.5d0 * (m / d_m_1))) / l)))))
end if
code = tmp
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -1e+247) {
tmp = w0 * (Math.sqrt((-0.25 * ((h * Math.pow((M * D_m), 2.0)) / l))) / d_m);
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
}
return tmp;
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): tmp = 0 if (math.pow(((M * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -1e+247: tmp = w0 * (math.sqrt((-0.25 * ((h * math.pow((M * D_m), 2.0)) / l))) / d_m) else: tmp = w0 * math.sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l))))) return tmp
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -1e+247) tmp = Float64(w0 * Float64(sqrt(Float64(-0.25 * Float64(Float64(h * (Float64(M * D_m) ^ 2.0)) / l))) / d_m)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(D_m * 0.5) * Float64(M / d_m)) * Float64(Float64(D_m * Float64(0.5 * Float64(M / d_m))) / l)))))); end return tmp end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M, D_m, h, l, d_m)
tmp = 0.0;
if (((((M * D_m) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -1e+247)
tmp = w0 * (sqrt((-0.25 * ((h * ((M * D_m) ^ 2.0)) / l))) / d_m);
else
tmp = w0 * sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+247], N[(w0 * N[(N[Sqrt[N[(-0.25 * N[(N[(h * N[Power[N[(M * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * N[(0.5 * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+247}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{-0.25 \cdot \frac{h \cdot {\left(M \cdot D\_m\right)}^{2}}{\ell}}}{d\_m}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\left(\left(D\_m \cdot 0.5\right) \cdot \frac{M}{d\_m}\right) \cdot \frac{D\_m \cdot \left(0.5 \cdot \frac{M}{d\_m}\right)}{\ell}\right)}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -9.99999999999999952e246Initial program 58.7%
Simplified58.6%
Taylor expanded in D around inf 40.0%
associate-*r/40.0%
times-frac40.1%
associate-*r*40.2%
Simplified40.2%
associate-*l/40.2%
sqrt-div43.8%
associate-/l*45.1%
pow-prod-down59.7%
sqrt-pow128.1%
metadata-eval28.1%
pow128.1%
Applied egg-rr28.1%
associate-*r/30.3%
Applied egg-rr30.3%
if -9.99999999999999952e246 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 83.0%
Simplified83.1%
Applied egg-rr83.1%
unpow183.1%
associate-*l/94.3%
associate-/l*94.3%
associate-*r/94.3%
times-frac94.3%
associate-*r/94.3%
Simplified94.3%
div-inv94.2%
div-inv94.2%
metadata-eval94.2%
Applied egg-rr94.2%
unpow294.2%
*-un-lft-identity94.2%
times-frac96.3%
associate-*l*94.8%
div-inv94.8%
associate-*l*94.8%
associate-*l*96.2%
div-inv96.2%
associate-*l*96.2%
Applied egg-rr96.2%
/-rgt-identity96.2%
associate-*r*96.2%
Applied egg-rr96.2%
Final simplification76.1%
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M D_m h l d_m)
:precision binary64
(*
w0
(sqrt
(-
1.0
(* h (* (* (* D_m 0.5) (/ M d_m)) (/ (* D_m (* 0.5 (/ M d_m))) l)))))))D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h * (((d_m * 0.5d0) * (m / d_m_1)) * ((d_m * (0.5d0 * (m / d_m_1))) / l)))))
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))))
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(D_m * 0.5) * Float64(M / d_m)) * Float64(Float64(D_m * Float64(0.5 * Float64(M / d_m))) / l)))))) end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp = code(w0, M, D_m, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * (((D_m * 0.5) * (M / d_m)) * ((D_m * (0.5 * (M / d_m))) / l)))));
end
D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * N[(0.5 * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \left(\left(\left(D\_m \cdot 0.5\right) \cdot \frac{M}{d\_m}\right) \cdot \frac{D\_m \cdot \left(0.5 \cdot \frac{M}{d\_m}\right)}{\ell}\right)}
\end{array}
Initial program 75.6%
Simplified75.6%
Applied egg-rr75.6%
unpow175.6%
associate-*l/83.8%
associate-/l*83.8%
associate-*r/83.4%
times-frac83.8%
associate-*r/83.4%
Simplified83.4%
div-inv83.4%
div-inv83.4%
metadata-eval83.4%
Applied egg-rr83.4%
unpow283.4%
*-un-lft-identity83.4%
times-frac85.6%
associate-*l*84.2%
div-inv84.2%
associate-*l*84.2%
associate-*l*85.9%
div-inv85.9%
associate-*l*85.9%
Applied egg-rr85.9%
/-rgt-identity85.9%
associate-*r*85.9%
Applied egg-rr85.9%
D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d_m) :precision binary64 (let* ((t_0 (* D_m (/ M d_m)))) (* w0 (sqrt (- 1.0 (* h (/ (/ (* t_0 t_0) 4.0) l)))))))
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
double t_0 = D_m * (M / d_m);
return w0 * sqrt((1.0 - (h * (((t_0 * t_0) / 4.0) / l))));
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
real(8) :: t_0
t_0 = d_m * (m / d_m_1)
code = w0 * sqrt((1.0d0 - (h * (((t_0 * t_0) / 4.0d0) / l))))
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
double t_0 = D_m * (M / d_m);
return w0 * Math.sqrt((1.0 - (h * (((t_0 * t_0) / 4.0) / l))));
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): t_0 = D_m * (M / d_m) return w0 * math.sqrt((1.0 - (h * (((t_0 * t_0) / 4.0) / l))))
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) t_0 = Float64(D_m * Float64(M / d_m)) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(t_0 * t_0) / 4.0) / l))))) end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp = code(w0, M, D_m, h, l, d_m)
t_0 = D_m * (M / d_m);
tmp = w0 * sqrt((1.0 - (h * (((t_0 * t_0) / 4.0) / l))));
end
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / 4.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d\_m}\\
w0 \cdot \sqrt{1 - h \cdot \frac{\frac{t\_0 \cdot t\_0}{4}}{\ell}}
\end{array}
\end{array}
Initial program 75.6%
Simplified75.6%
Applied egg-rr75.6%
unpow175.6%
associate-*l/83.8%
associate-/l*83.8%
associate-*r/83.4%
times-frac83.8%
associate-*r/83.4%
Simplified83.4%
div-inv83.4%
div-inv83.4%
metadata-eval83.4%
Applied egg-rr83.4%
associate-*l*83.8%
div-inv83.8%
metadata-eval83.8%
div-inv83.8%
unpow283.8%
associate-*l/83.8%
associate-*l/83.8%
frac-times83.8%
metadata-eval83.8%
Applied egg-rr83.8%
D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (* (* M D_m) (/ (/ (* M D_m) d_m) (* d_m 4.0))) l))))))
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (((M * D_m) * (((M * D_m) / d_m) / (d_m * 4.0))) / l))));
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h * (((m * d_m) * (((m * d_m) / d_m_1) / (d_m_1 * 4.0d0))) / l))))
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (((M * D_m) * (((M * D_m) / d_m) / (d_m * 4.0))) / l))));
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (((M * D_m) * (((M * D_m) / d_m) / (d_m * 4.0))) / l))))
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * D_m) * Float64(Float64(Float64(M * D_m) / d_m) / Float64(d_m * 4.0))) / l))))) end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp = code(w0, M, D_m, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * (((M * D_m) * (((M * D_m) / d_m) / (d_m * 4.0))) / l))));
end
D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(M * D$95$m), $MachinePrecision] * N[(N[(N[(M * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] / N[(d$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{\left(M \cdot D\_m\right) \cdot \frac{\frac{M \cdot D\_m}{d\_m}}{d\_m \cdot 4}}{\ell}}
\end{array}
Initial program 75.6%
Simplified75.6%
Applied egg-rr75.6%
unpow175.6%
associate-*l/83.8%
associate-/l*83.8%
associate-*r/83.4%
times-frac83.8%
associate-*r/83.4%
Simplified83.4%
div-inv83.4%
div-inv83.4%
metadata-eval83.4%
Applied egg-rr83.4%
associate-*l*83.8%
div-inv83.8%
metadata-eval83.8%
div-inv83.8%
unpow283.8%
frac-times83.0%
associate-*l/83.0%
frac-times82.7%
Applied egg-rr82.7%
associate-/l*81.1%
*-commutative81.1%
associate-*r*81.1%
metadata-eval81.1%
Simplified81.1%
Taylor expanded in D around 0 81.5%
Final simplification81.5%
D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (* (* M D_m) (/ (* D_m (/ M d_m)) (* d_m 4.0))) l))))))
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (((M * D_m) * ((D_m * (M / d_m)) / (d_m * 4.0))) / l))));
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h * (((m * d_m) * ((d_m * (m / d_m_1)) / (d_m_1 * 4.0d0))) / l))))
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (((M * D_m) * ((D_m * (M / d_m)) / (d_m * 4.0))) / l))));
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (((M * D_m) * ((D_m * (M / d_m)) / (d_m * 4.0))) / l))))
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * D_m) * Float64(Float64(D_m * Float64(M / d_m)) / Float64(d_m * 4.0))) / l))))) end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp = code(w0, M, D_m, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * (((M * D_m) * ((D_m * (M / d_m)) / (d_m * 4.0))) / l))));
end
D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(M * D$95$m), $MachinePrecision] * N[(N[(D$95$m * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{\left(M \cdot D\_m\right) \cdot \frac{D\_m \cdot \frac{M}{d\_m}}{d\_m \cdot 4}}{\ell}}
\end{array}
Initial program 75.6%
Simplified75.6%
Applied egg-rr75.6%
unpow175.6%
associate-*l/83.8%
associate-/l*83.8%
associate-*r/83.4%
times-frac83.8%
associate-*r/83.4%
Simplified83.4%
div-inv83.4%
div-inv83.4%
metadata-eval83.4%
Applied egg-rr83.4%
associate-*l*83.8%
div-inv83.8%
metadata-eval83.8%
div-inv83.8%
unpow283.8%
frac-times83.0%
associate-*l/83.0%
frac-times82.7%
Applied egg-rr82.7%
associate-/l*81.1%
*-commutative81.1%
associate-*r*81.1%
metadata-eval81.1%
Simplified81.1%
Final simplification81.1%
D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d_m) :precision binary64 w0)
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0;
}
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d_m_1)
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_m_1
code = w0
end function
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M && M < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M, double D_m, double h, double l, double d_m) {
return w0;
}
D_m = math.fabs(D) d_m = math.fabs(d) [w0, M, D_m, h, l, d_m] = sort([w0, M, D_m, h, l, d_m]) def code(w0, M, D_m, h, l, d_m): return w0
D_m = abs(D) d_m = abs(d) w0, M, D_m, h, l, d_m = sort([w0, M, D_m, h, l, d_m]) function code(w0, M, D_m, h, l, d_m) return w0 end
D_m = abs(D);
d_m = abs(d);
w0, M, D_m, h, l, d_m = num2cell(sort([w0, M, D_m, h, l, d_m])){:}
function tmp = code(w0, M, D_m, h, l, d_m)
tmp = w0;
end
D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M, D_m, h, l, d_m] = \mathsf{sort}([w0, M, D_m, h, l, d_m])\\
\\
w0
\end{array}
Initial program 75.6%
Simplified75.6%
Taylor expanded in D around 0 62.2%
herbie shell --seed 2024159
(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))))))