
(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 8 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
(let* ((t_0 (* (* M_m (/ (* D 0.5) d)) (sqrt h))))
(if (<= h 2e-173)
(* w0 (sqrt (- 1.0 (/ (* h (pow (* (* D M_m) (/ 0.5 d)) 2.0)) l))))
(* w0 (sqrt (- 1.0 (* t_0 (/ t_0 l))))))))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 = (M_m * ((D * 0.5) / d)) * sqrt(h);
double tmp;
if (h <= 2e-173) {
tmp = w0 * sqrt((1.0 - ((h * pow(((D * M_m) * (0.5 / d)), 2.0)) / l)));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
}
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 = (m_m * ((d * 0.5d0) / d_1)) * sqrt(h)
if (h <= 2d-173) then
tmp = w0 * sqrt((1.0d0 - ((h * (((d * m_m) * (0.5d0 / d_1)) ** 2.0d0)) / l)))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 / l))))
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 = (M_m * ((D * 0.5) / d)) * Math.sqrt(h);
double tmp;
if (h <= 2e-173) {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow(((D * M_m) * (0.5 / d)), 2.0)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 / l))));
}
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 = (M_m * ((D * 0.5) / d)) * math.sqrt(h) tmp = 0 if h <= 2e-173: tmp = w0 * math.sqrt((1.0 - ((h * math.pow(((D * M_m) * (0.5 / d)), 2.0)) / l))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 / l)))) 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(Float64(M_m * Float64(Float64(D * 0.5) / d)) * sqrt(h)) tmp = 0.0 if (h <= 2e-173) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(D * M_m) * Float64(0.5 / d)) ^ 2.0)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 / l))))); 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 = (M_m * ((D * 0.5) / d)) * sqrt(h);
tmp = 0.0;
if (h <= 2e-173)
tmp = w0 * sqrt((1.0 - ((h * (((D * M_m) * (0.5 / d)) ^ 2.0)) / l)));
else
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
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[(N[(M$95$m * N[(N[(D * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, 2e-173], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(D * M$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 / l), $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])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot \frac{D \cdot 0.5}{d}\right) \cdot \sqrt{h}\\
\mathbf{if}\;h \leq 2 \cdot 10^{-173}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\left(D \cdot M\_m\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \frac{t\_0}{\ell}}\\
\end{array}
\end{array}
if h < 2.0000000000000001e-173Initial program 84.9%
Simplified83.6%
associate-*r/85.6%
clear-num85.6%
add-sqr-sqrt85.6%
pow285.6%
sqrt-pow185.6%
metadata-eval85.6%
pow185.6%
*-un-lft-identity85.6%
times-frac85.6%
metadata-eval85.6%
Applied egg-rr85.6%
associate-/r/85.6%
*-commutative85.6%
associate-*r*85.6%
associate-*r/86.8%
*-commutative86.8%
associate-*r/86.8%
associate-*r/86.8%
Simplified86.8%
associate-*l/86.8%
*-un-lft-identity86.8%
associate-*r*86.8%
Applied egg-rr86.8%
if 2.0000000000000001e-173 < h Initial program 76.4%
Simplified76.4%
associate-*r/86.4%
add-sqr-sqrt86.4%
pow286.4%
sqrt-pow186.4%
metadata-eval86.4%
pow186.4%
*-un-lft-identity86.4%
times-frac86.4%
metadata-eval86.4%
Applied egg-rr86.4%
add-sqr-sqrt86.4%
*-un-lft-identity86.4%
times-frac86.4%
sqrt-prod86.4%
sqrt-pow176.7%
metadata-eval76.7%
pow176.7%
associate-*r/76.7%
sqrt-prod76.7%
sqrt-pow191.8%
metadata-eval91.8%
pow191.8%
associate-*r/91.8%
Applied egg-rr91.8%
Final simplification88.7%
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 (- 1.0 (* (pow (/ (* D M_m) (* d 2.0)) 2.0) (/ h l)))))
(if (<= t_0 5e+264)
(* w0 (sqrt t_0))
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (/ (* D 0.5) d)) 2.0) l))))))))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 = 1.0 - (pow(((D * M_m) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+264) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * ((D * 0.5) / d)), 2.0) / l))));
}
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 = 1.0d0 - ((((d * m_m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+264) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (h * (((m_m * ((d * 0.5d0) / d_1)) ** 2.0d0) / l))))
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 = 1.0 - (Math.pow(((D * M_m) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+264) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * ((D * 0.5) / d)), 2.0) / l))));
}
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 = 1.0 - (math.pow(((D * M_m) / (d * 2.0)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+264: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M_m * ((D * 0.5) / d)), 2.0) / l)))) 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(1.0 - Float64((Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+264) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(Float64(D * 0.5) / d)) ^ 2.0) / l))))); 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 = 1.0 - ((((D * M_m) / (d * 2.0)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 5e+264)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - (h * (((M_m * ((D * 0.5) / d)) ^ 2.0) / l))));
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[(1.0 - N[(N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+264], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(N[(D * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+264}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M\_m \cdot \frac{D \cdot 0.5}{d}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 5.00000000000000033e264Initial program 99.9%
if 5.00000000000000033e264 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 40.2%
Simplified40.2%
associate-*r/58.9%
add-sqr-sqrt58.9%
pow258.9%
sqrt-pow158.9%
metadata-eval58.9%
pow158.9%
*-un-lft-identity58.9%
times-frac58.9%
metadata-eval58.9%
Applied egg-rr58.9%
*-un-lft-identity58.9%
associate-*r/40.2%
add-sqr-sqrt40.2%
pow240.2%
sqrt-pow140.2%
metadata-eval40.2%
pow140.2%
associate-*r/40.2%
Applied egg-rr40.2%
*-lft-identity40.2%
associate-*r/58.9%
*-commutative58.9%
associate-*r/61.3%
*-commutative61.3%
Simplified61.3%
Final simplification88.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 (* w0 (sqrt (- 1.0 (/ (* h (pow (* (* D M_m) (/ 0.5 d)) 2.0)) l)))))
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 - ((h * pow(((D * M_m) * (0.5 / d)), 2.0)) / l)));
}
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 - ((h * (((d * m_m) * (0.5d0 / d_1)) ** 2.0d0)) / l)))
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 - ((h * Math.pow(((D * M_m) * (0.5 / d)), 2.0)) / l)));
}
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 - ((h * math.pow(((D * M_m) * (0.5 / d)), 2.0)) / l)))
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(h * (Float64(Float64(D * M_m) * Float64(0.5 / d)) ^ 2.0)) / l)))) 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 - ((h * (((D * M_m) * (0.5 / d)) ^ 2.0)) / l)));
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[(h * N[Power[N[(N[(D * M$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $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{h \cdot {\left(\left(D \cdot M\_m\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 81.7%
Simplified81.0%
associate-*r/85.9%
clear-num85.9%
add-sqr-sqrt85.9%
pow285.9%
sqrt-pow185.9%
metadata-eval85.9%
pow185.9%
*-un-lft-identity85.9%
times-frac85.9%
metadata-eval85.9%
Applied egg-rr85.9%
associate-/r/85.9%
*-commutative85.9%
associate-*r*85.9%
associate-*r/86.7%
*-commutative86.7%
associate-*r/86.3%
associate-*r/86.3%
Simplified86.3%
associate-*l/86.3%
*-un-lft-identity86.3%
associate-*r*86.7%
Applied egg-rr86.7%
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 (* h (/ (pow (* M_m (/ (* D 0.5) d)) 2.0) l))))))
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 - (h * (pow((M_m * ((D * 0.5) / d)), 2.0) / l))));
}
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 - (h * (((m_m * ((d * 0.5d0) / d_1)) ** 2.0d0) / l))))
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 - (h * (Math.pow((M_m * ((D * 0.5) / d)), 2.0) / l))));
}
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 - (h * (math.pow((M_m * ((D * 0.5) / d)), 2.0) / l))))
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(h * Float64((Float64(M_m * Float64(Float64(D * 0.5) / d)) ^ 2.0) / l))))) 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 - (h * (((M_m * ((D * 0.5) / d)) ^ 2.0) / l))));
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[(h * N[(N[Power[N[(M$95$m * N[(N[(D * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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 - h \cdot \frac{{\left(M\_m \cdot \frac{D \cdot 0.5}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 81.7%
Simplified81.0%
associate-*r/85.9%
add-sqr-sqrt85.9%
pow285.9%
sqrt-pow185.9%
metadata-eval85.9%
pow185.9%
*-un-lft-identity85.9%
times-frac85.9%
metadata-eval85.9%
Applied egg-rr85.9%
*-un-lft-identity85.9%
associate-*r/81.0%
add-sqr-sqrt81.0%
pow281.0%
sqrt-pow181.0%
metadata-eval81.0%
pow181.0%
associate-*r/81.0%
Applied egg-rr81.0%
*-lft-identity81.0%
associate-*r/85.9%
*-commutative85.9%
associate-*r/85.9%
*-commutative85.9%
Simplified85.9%
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 (<= D 2.6e+14)
w0
(*
w0
(+
1.0
(* (* (pow (* D M_m) 2.0) (* (/ 1.0 l) (* (/ 1.0 d) (/ h d)))) -0.125)))))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 (D <= 2.6e+14) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((pow((D * M_m), 2.0) * ((1.0 / l) * ((1.0 / d) * (h / d)))) * -0.125));
}
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) :: tmp
if (d <= 2.6d+14) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((((d * m_m) ** 2.0d0) * ((1.0d0 / l) * ((1.0d0 / d_1) * (h / d_1)))) * (-0.125d0)))
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 tmp;
if (D <= 2.6e+14) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((Math.pow((D * M_m), 2.0) * ((1.0 / l) * ((1.0 / d) * (h / d)))) * -0.125));
}
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 D <= 2.6e+14: tmp = w0 else: tmp = w0 * (1.0 + ((math.pow((D * M_m), 2.0) * ((1.0 / l) * ((1.0 / d) * (h / d)))) * -0.125)) 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 (D <= 2.6e+14) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64((Float64(D * M_m) ^ 2.0) * Float64(Float64(1.0 / l) * Float64(Float64(1.0 / d) * Float64(h / d)))) * -0.125))); 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)
tmp = 0.0;
if (D <= 2.6e+14)
tmp = w0;
else
tmp = w0 * (1.0 + ((((D * M_m) ^ 2.0) * ((1.0 / l) * ((1.0 / d) * (h / d)))) * -0.125));
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_] := If[LessEqual[D, 2.6e+14], w0, N[(w0 * N[(1.0 + N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(1.0 / l), $MachinePrecision] * N[(N[(1.0 / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.6 \cdot 10^{+14}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left({\left(D \cdot M\_m\right)}^{2} \cdot \left(\frac{1}{\ell} \cdot \left(\frac{1}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if D < 2.6e14Initial program 85.7%
Simplified85.7%
Taylor expanded in M around 0 72.4%
if 2.6e14 < D Initial program 67.8%
Simplified64.3%
Taylor expanded in M around 0 34.4%
*-commutative34.4%
associate-/l*34.4%
associate-/l*36.2%
Simplified36.2%
Taylor expanded in D around 0 34.4%
associate-*r*34.5%
*-commutative34.5%
unpow234.5%
unpow234.5%
swap-sqr57.6%
unpow257.6%
associate-*r/57.5%
*-commutative57.5%
Simplified57.5%
*-un-lft-identity57.5%
*-commutative57.5%
times-frac57.5%
Applied egg-rr57.5%
*-un-lft-identity57.5%
unpow257.5%
times-frac62.7%
Applied egg-rr62.7%
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 (<= (/ h l) -1e-143)
(*
w0
(+ 1.0 (* -0.125 (* (* (* D M_m) (* D M_m)) (/ h (* l (pow d 2.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 tmp;
if ((h / l) <= -1e-143) {
tmp = w0 * (1.0 + (-0.125 * (((D * M_m) * (D * M_m)) * (h / (l * pow(d, 2.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) :: tmp
if ((h / l) <= (-1d-143)) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * m_m) * (d * m_m)) * (h / (l * (d_1 ** 2.0d0))))))
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 tmp;
if ((h / l) <= -1e-143) {
tmp = w0 * (1.0 + (-0.125 * (((D * M_m) * (D * M_m)) * (h / (l * Math.pow(d, 2.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): tmp = 0 if (h / l) <= -1e-143: tmp = w0 * (1.0 + (-0.125 * (((D * M_m) * (D * M_m)) * (h / (l * math.pow(d, 2.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) tmp = 0.0 if (Float64(h / l) <= -1e-143) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * M_m) * Float64(D * M_m)) * Float64(h / Float64(l * (d ^ 2.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)
tmp = 0.0;
if ((h / l) <= -1e-143)
tmp = w0 * (1.0 + (-0.125 * (((D * M_m) * (D * M_m)) * (h / (l * (d ^ 2.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_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-143], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * M$95$m), $MachinePrecision] * N[(D * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * N[Power[d, 2.0], $MachinePrecision]), $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}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-143}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\left(D \cdot M\_m\right) \cdot \left(D \cdot M\_m\right)\right) \cdot \frac{h}{\ell \cdot {d}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.9999999999999995e-144Initial program 73.9%
Simplified74.0%
Taylor expanded in M around 0 42.1%
*-commutative42.1%
associate-/l*43.0%
associate-/l*44.7%
Simplified44.7%
Taylor expanded in D around 0 42.1%
associate-*r*44.7%
*-commutative44.7%
unpow244.7%
unpow244.7%
swap-sqr55.6%
unpow255.6%
associate-*r/56.6%
*-commutative56.6%
Simplified56.6%
unpow256.6%
Applied egg-rr56.6%
if -9.9999999999999995e-144 < (/.f64 h l) Initial program 88.1%
Simplified86.7%
Taylor expanded in M around 0 89.5%
Final simplification74.7%
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 1200000000.0) w0 (* -0.125 (* (* (* D M_m) (* D M_m)) (/ (* h w0) (* l (pow d 2.0)))))))
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 <= 1200000000.0) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M_m) * (D * M_m)) * ((h * w0) / (l * pow(d, 2.0))));
}
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) :: tmp
if (m_m <= 1200000000.0d0) then
tmp = w0
else
tmp = (-0.125d0) * (((d * m_m) * (d * m_m)) * ((h * w0) / (l * (d_1 ** 2.0d0))))
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 tmp;
if (M_m <= 1200000000.0) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M_m) * (D * M_m)) * ((h * w0) / (l * Math.pow(d, 2.0))));
}
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 <= 1200000000.0: tmp = w0 else: tmp = -0.125 * (((D * M_m) * (D * M_m)) * ((h * w0) / (l * math.pow(d, 2.0)))) 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 <= 1200000000.0) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D * M_m) * Float64(D * M_m)) * Float64(Float64(h * w0) / Float64(l * (d ^ 2.0))))); 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)
tmp = 0.0;
if (M_m <= 1200000000.0)
tmp = w0;
else
tmp = -0.125 * (((D * M_m) * (D * M_m)) * ((h * w0) / (l * (d ^ 2.0))));
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_] := If[LessEqual[M$95$m, 1200000000.0], w0, N[(-0.125 * N[(N[(N[(D * M$95$m), $MachinePrecision] * N[(D * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(h * w0), $MachinePrecision] / N[(l * N[Power[d, 2.0], $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])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 1200000000:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot M\_m\right) \cdot \left(D \cdot M\_m\right)\right) \cdot \frac{h \cdot w0}{\ell \cdot {d}^{2}}\right)\\
\end{array}
\end{array}
if M < 1.2e9Initial program 85.7%
Simplified84.7%
Taylor expanded in M around 0 73.0%
if 1.2e9 < M Initial program 65.8%
Simplified65.8%
Taylor expanded in M around 0 46.1%
*-commutative46.1%
associate-/l*46.1%
associate-/l*46.0%
Simplified46.0%
Taylor expanded in D around 0 46.1%
associate-*r*44.2%
*-commutative44.2%
unpow244.2%
unpow244.2%
swap-sqr61.8%
unpow261.8%
associate-*r/61.7%
*-commutative61.7%
Simplified61.7%
Taylor expanded in D around inf 21.3%
associate-*r*21.3%
unpow221.3%
unpow221.3%
swap-sqr22.0%
unpow222.0%
associate-*r/21.9%
Simplified21.9%
unpow261.7%
Applied egg-rr21.9%
Final simplification62.8%
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.7%
Simplified81.0%
Taylor expanded in M around 0 68.2%
herbie shell --seed 2024107
(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))))))