
(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}
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 (<= l 5e-179)
(*
w0
(sqrt
(- 1.0 (* (* 0.5 (* M_m (/ D d))) (/ (* h (* M_m (* 0.5 (/ D d)))) l)))))
(*
w0
(sqrt
(-
1.0
(* (* D (* M_m (/ 0.5 d))) (* 0.5 (* (* h (/ M_m d)) (/ D 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 tmp;
if (l <= 5e-179) {
tmp = w0 * sqrt((1.0 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / l))));
} else {
tmp = w0 * sqrt((1.0 - ((D * (M_m * (0.5 / d))) * (0.5 * ((h * (M_m / d)) * (D / 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) :: tmp
if (l <= 5d-179) then
tmp = w0 * sqrt((1.0d0 - ((0.5d0 * (m_m * (d / d_1))) * ((h * (m_m * (0.5d0 * (d / d_1)))) / l))))
else
tmp = w0 * sqrt((1.0d0 - ((d * (m_m * (0.5d0 / d_1))) * (0.5d0 * ((h * (m_m / d_1)) * (d / 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 tmp;
if (l <= 5e-179) {
tmp = w0 * Math.sqrt((1.0 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((D * (M_m * (0.5 / d))) * (0.5 * ((h * (M_m / d)) * (D / 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): tmp = 0 if l <= 5e-179: tmp = w0 * math.sqrt((1.0 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / l)))) else: tmp = w0 * math.sqrt((1.0 - ((D * (M_m * (0.5 / d))) * (0.5 * ((h * (M_m / d)) * (D / 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) tmp = 0.0 if (l <= 5e-179) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.5 * Float64(M_m * Float64(D / d))) * Float64(Float64(h * Float64(M_m * Float64(0.5 * Float64(D / d)))) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(D * Float64(M_m * Float64(0.5 / d))) * Float64(0.5 * Float64(Float64(h * Float64(M_m / d)) * Float64(D / 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)
tmp = 0.0;
if (l <= 5e-179)
tmp = w0 * sqrt((1.0 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / l))));
else
tmp = w0 * sqrt((1.0 - ((D * (M_m * (0.5 / d))) * (0.5 * ((h * (M_m / d)) * (D / 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_] := If[LessEqual[l, 5e-179], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5 \cdot 10^{-179}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(0.5 \cdot \left(M\_m \cdot \frac{D}{d}\right)\right) \cdot \frac{h \cdot \left(M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right) \cdot \left(0.5 \cdot \left(\left(h \cdot \frac{M\_m}{d}\right) \cdot \frac{D}{\ell}\right)\right)}\\
\end{array}
\end{array}
if l < 4.9999999999999998e-179Initial program 81.2%
Simplified81.8%
unpow281.8%
associate-*r/81.2%
div-inv81.2%
associate-*l*79.9%
associate-/r*79.9%
metadata-eval79.9%
*-un-lft-identity79.9%
times-frac79.9%
metadata-eval79.9%
Applied egg-rr79.9%
associate-*r/86.9%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
Applied egg-rr88.1%
associate-*l*88.4%
associate-*l*88.3%
Simplified88.3%
associate-/l*89.0%
*-commutative89.0%
associate-*l*89.0%
Applied egg-rr89.0%
Taylor expanded in D around 0 89.0%
*-commutative89.0%
associate-/l*89.6%
Simplified89.6%
if 4.9999999999999998e-179 < l Initial program 81.6%
Simplified82.5%
unpow282.5%
associate-*r/81.7%
div-inv81.7%
associate-*l*78.7%
associate-/r*78.7%
metadata-eval78.7%
*-un-lft-identity78.7%
times-frac78.7%
metadata-eval78.7%
Applied egg-rr78.7%
associate-*r/79.9%
associate-*r*82.8%
*-commutative82.8%
associate-*r*82.8%
Applied egg-rr82.8%
associate-*l*86.6%
associate-*l*83.7%
Simplified83.7%
associate-/l*84.5%
*-commutative84.5%
associate-*l*84.5%
Applied egg-rr84.5%
Taylor expanded in h around 0 81.7%
*-commutative81.7%
*-commutative81.7%
times-frac80.6%
associate-/l*84.4%
Simplified84.4%
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
:precision binary64
(if (<= (/ h l) -9.5e-245)
(*
w0
(sqrt (- 1.0 (* (/ h l) (* (* D M_m) (/ (* (/ (* D M_m) d) 0.25) d))))))
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) <= -9.5e-245) {
tmp = w0 * sqrt((1.0 - ((h / l) * ((D * M_m) * ((((D * M_m) / d) * 0.25) / d)))));
} 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) <= (-9.5d-245)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d * m_m) * ((((d * m_m) / d_1) * 0.25d0) / d_1)))))
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) <= -9.5e-245) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * ((D * M_m) * ((((D * M_m) / d) * 0.25) / d)))));
} 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) <= -9.5e-245: tmp = w0 * math.sqrt((1.0 - ((h / l) * ((D * M_m) * ((((D * M_m) / d) * 0.25) / d))))) 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) <= -9.5e-245) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(D * M_m) * Float64(Float64(Float64(Float64(D * M_m) / d) * 0.25) / d)))))); 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) <= -9.5e-245)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D * M_m) * ((((D * M_m) / d) * 0.25) / d)))));
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], -9.5e-245], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(D * M$95$m), $MachinePrecision] * N[(N[(N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] / d), $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 -9.5 \cdot 10^{-245}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\left(D \cdot M\_m\right) \cdot \frac{\frac{D \cdot M\_m}{d} \cdot 0.25}{d}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.5000000000000002e-245Initial program 78.5%
Simplified79.9%
unpow279.9%
associate-*r/78.5%
div-inv78.5%
associate-*l*78.5%
associate-/r*78.5%
metadata-eval78.5%
*-un-lft-identity78.5%
times-frac78.5%
metadata-eval78.5%
Applied egg-rr78.5%
associate-*r/79.8%
associate-*r*79.8%
*-commutative79.8%
associate-*r*79.8%
Applied egg-rr79.8%
associate-/l*78.5%
*-commutative78.5%
associate-*l*78.5%
associate-*r/78.5%
associate-*r/78.5%
Simplified78.5%
Taylor expanded in d around 0 78.5%
if -9.5000000000000002e-245 < (/.f64 h l) Initial program 84.6%
Simplified84.6%
Taylor expanded in M around 0 91.6%
Final simplification84.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 (sqrt (- 1.0 (* (* D (* M_m (/ 0.5 d))) (/ (* h (* 0.5 (/ (* D M_m) d))) 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 - ((D * (M_m * (0.5 / d))) * ((h * (0.5 * ((D * M_m) / d))) / 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 - ((d * (m_m * (0.5d0 / d_1))) * ((h * (0.5d0 * ((d * m_m) / d_1))) / 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 - ((D * (M_m * (0.5 / d))) * ((h * (0.5 * ((D * M_m) / d))) / 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 - ((D * (M_m * (0.5 / d))) * ((h * (0.5 * ((D * M_m) / d))) / 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(D * Float64(M_m * Float64(0.5 / d))) * Float64(Float64(h * Float64(0.5 * Float64(Float64(D * M_m) / d))) / 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 - ((D * (M_m * (0.5 / d))) * ((h * (0.5 * ((D * M_m) / d))) / 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[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(0.5 * N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $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 - \left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right) \cdot \frac{h \cdot \left(0.5 \cdot \frac{D \cdot M\_m}{d}\right)}{\ell}}
\end{array}
Initial program 81.4%
Simplified82.1%
unpow282.1%
associate-*r/81.4%
div-inv81.4%
associate-*l*79.4%
associate-/r*79.4%
metadata-eval79.4%
*-un-lft-identity79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
associate-*r/84.2%
associate-*r*86.1%
*-commutative86.1%
associate-*r*86.1%
Applied egg-rr86.1%
associate-*l*87.7%
associate-*l*86.5%
Simplified86.5%
associate-/l*87.2%
*-commutative87.2%
associate-*l*87.2%
Applied egg-rr87.2%
Taylor expanded in M around 0 87.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 (* (* 0.5 (* M_m (/ D d))) (/ (* h (* M_m (* 0.5 (/ D d)))) 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 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / 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 - ((0.5d0 * (m_m * (d / d_1))) * ((h * (m_m * (0.5d0 * (d / d_1)))) / 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 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / 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 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / 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(0.5 * Float64(M_m * Float64(D / d))) * Float64(Float64(h * Float64(M_m * Float64(0.5 * Float64(D / d)))) / 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 - ((0.5 * (M_m * (D / d))) * ((h * (M_m * (0.5 * (D / d)))) / 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[(0.5 * N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \left(0.5 \cdot \left(M\_m \cdot \frac{D}{d}\right)\right) \cdot \frac{h \cdot \left(M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}{\ell}}
\end{array}
Initial program 81.4%
Simplified82.1%
unpow282.1%
associate-*r/81.4%
div-inv81.4%
associate-*l*79.4%
associate-/r*79.4%
metadata-eval79.4%
*-un-lft-identity79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
associate-*r/84.2%
associate-*r*86.1%
*-commutative86.1%
associate-*r*86.1%
Applied egg-rr86.1%
associate-*l*87.7%
associate-*l*86.5%
Simplified86.5%
associate-/l*87.2%
*-commutative87.2%
associate-*l*87.2%
Applied egg-rr87.2%
Taylor expanded in D around 0 88.0%
*-commutative88.0%
associate-/l*89.1%
Simplified89.1%
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 (* D (* M_m (/ (/ (* (* D M_m) 0.25) d) d)))) 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 * (D * (M_m * ((((D * M_m) * 0.25) / d) / d)))) / 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 * ((((d * m_m) * 0.25d0) / d_1) / d_1)))) / 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 * (D * (M_m * ((((D * M_m) * 0.25) / d) / d)))) / 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 * (D * (M_m * ((((D * M_m) * 0.25) / d) / d)))) / 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(D * Float64(M_m * Float64(Float64(Float64(Float64(D * M_m) * 0.25) / d) / d)))) / 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 * ((((D * M_m) * 0.25) / d) / d)))) / 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[(D * N[(M$95$m * N[(N[(N[(N[(D * M$95$m), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $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(D \cdot \left(M\_m \cdot \frac{\frac{\left(D \cdot M\_m\right) \cdot 0.25}{d}}{d}\right)\right)}{\ell}}
\end{array}
Initial program 81.4%
Simplified82.1%
unpow282.1%
associate-*r/81.4%
div-inv81.4%
associate-*l*79.4%
associate-/r*79.4%
metadata-eval79.4%
*-un-lft-identity79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
associate-*r/84.2%
associate-*r*86.1%
*-commutative86.1%
associate-*r*86.1%
Applied egg-rr86.1%
associate-/l*81.4%
*-commutative81.4%
associate-*l*79.4%
associate-*r/79.5%
associate-*r/79.5%
Simplified79.5%
Taylor expanded in d around 0 79.5%
associate-*l/84.5%
associate-*l*84.5%
associate-*r/84.5%
Applied egg-rr84.5%
Final simplification84.5%
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.4%
Simplified82.1%
Taylor expanded in M around 0 67.1%
herbie shell --seed 2024113
(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))))))