
(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 11 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)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (/ h l) -5e-251)
(*
w0
(sqrt
(+
1.0
(*
(/ (* h (* M_m (* D_m (/ 0.5 d)))) (* 2.0 (/ (/ d D_m) M_m)))
(/ -1.0 l)))))
(*
w0
(sqrt
(+
1.0
(/
(* 0.5 (/ (* D_m (* h M_m)) (* l d)))
(* (/ 1.0 (* D_m (/ M_m d))) -2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-251) {
tmp = w0 * sqrt((1.0 + (((h * (M_m * (D_m * (0.5 / d)))) / (2.0 * ((d / D_m) / M_m))) * (-1.0 / l))));
} else {
tmp = w0 * sqrt((1.0 + ((0.5 * ((D_m * (h * M_m)) / (l * d))) / ((1.0 / (D_m * (M_m / d))) * -2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((h / l) <= (-5d-251)) then
tmp = w0 * sqrt((1.0d0 + (((h * (m_m * (d_m * (0.5d0 / d)))) / (2.0d0 * ((d / d_m) / m_m))) * ((-1.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 + ((0.5d0 * ((d_m * (h * m_m)) / (l * d))) / ((1.0d0 / (d_m * (m_m / d))) * (-2.0d0)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-251) {
tmp = w0 * Math.sqrt((1.0 + (((h * (M_m * (D_m * (0.5 / d)))) / (2.0 * ((d / D_m) / M_m))) * (-1.0 / l))));
} else {
tmp = w0 * Math.sqrt((1.0 + ((0.5 * ((D_m * (h * M_m)) / (l * d))) / ((1.0 / (D_m * (M_m / d))) * -2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -5e-251: tmp = w0 * math.sqrt((1.0 + (((h * (M_m * (D_m * (0.5 / d)))) / (2.0 * ((d / D_m) / M_m))) * (-1.0 / l)))) else: tmp = w0 * math.sqrt((1.0 + ((0.5 * ((D_m * (h * M_m)) / (l * d))) / ((1.0 / (D_m * (M_m / d))) * -2.0)))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e-251) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(2.0 * Float64(Float64(d / D_m) / M_m))) * Float64(-1.0 / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(0.5 * Float64(Float64(D_m * Float64(h * M_m)) / Float64(l * d))) / Float64(Float64(1.0 / Float64(D_m * Float64(M_m / d))) * -2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e-251)
tmp = w0 * sqrt((1.0 + (((h * (M_m * (D_m * (0.5 / d)))) / (2.0 * ((d / D_m) / M_m))) * (-1.0 / l))));
else
tmp = w0 * sqrt((1.0 + ((0.5 * ((D_m * (h * M_m)) / (l * d))) / ((1.0 / (D_m * (M_m / d))) * -2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-251], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[(N[(d / D$95$m), $MachinePrecision] / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(0.5 * N[(N[(D$95$m * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-251}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{2 \cdot \frac{\frac{d}{D\_m}}{M\_m}} \cdot \frac{-1}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{0.5 \cdot \frac{D\_m \cdot \left(h \cdot M\_m\right)}{\ell \cdot d}}{\frac{1}{D\_m \cdot \frac{M\_m}{d}} \cdot -2}}\\
\end{array}
\end{array}
if (/.f64 h l) < -5.0000000000000003e-251Initial program 80.8%
Simplified80.8%
unpow280.8%
*-commutative80.8%
associate-*l/80.8%
associate-*r/80.2%
times-frac80.8%
clear-num80.8%
un-div-inv80.8%
*-commutative80.8%
associate-*l/80.8%
associate-*r/80.1%
times-frac80.8%
associate-/l*80.1%
div-inv80.2%
associate-/r*80.2%
metadata-eval80.2%
times-frac80.2%
Applied egg-rr80.2%
associate-*r/87.6%
associate-*r*87.6%
frac-times88.2%
Applied egg-rr88.2%
div-inv88.2%
associate-*r*87.6%
associate-*l/88.3%
*-commutative88.3%
associate-/l*88.3%
associate-/r*88.9%
Applied egg-rr88.9%
if -5.0000000000000003e-251 < (/.f64 h l) Initial program 87.5%
Simplified88.3%
unpow288.3%
*-commutative88.3%
associate-*l/87.5%
associate-*r/86.5%
times-frac87.5%
clear-num87.5%
un-div-inv87.5%
*-commutative87.5%
associate-*l/87.5%
associate-*r/85.7%
times-frac87.5%
associate-/l*85.7%
div-inv85.7%
associate-/r*85.7%
metadata-eval85.7%
times-frac86.5%
Applied egg-rr86.5%
*-un-lft-identity86.5%
associate-*r*86.6%
frac-times87.5%
Applied egg-rr87.5%
*-lft-identity87.5%
sub-neg87.5%
associate-*l/92.0%
distribute-neg-frac292.0%
*-commutative92.0%
associate-*l*89.3%
associate-/l*89.3%
*-commutative89.3%
*-commutative89.3%
distribute-rgt-neg-in89.3%
metadata-eval89.3%
Simplified89.3%
clear-num89.3%
inv-pow89.3%
*-commutative89.3%
Applied egg-rr89.3%
unpow-189.3%
*-commutative89.3%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in h around 0 95.2%
Final simplification91.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (* M_m D_m) 1e+176)
(*
w0
(sqrt
(-
1.0
(/ (/ (* h (* M_m (* D_m 0.5))) d) (* l (/ (* d 2.0) (* M_m D_m)))))))
(*
w0
(sqrt
(+
1.0
(/ (* (/ h l) (* M_m (* D_m (/ 0.5 d)))) (/ (/ -2.0 D_m) (/ M_m d))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 1e+176) {
tmp = w0 * sqrt((1.0 - (((h * (M_m * (D_m * 0.5))) / d) / (l * ((d * 2.0) / (M_m * D_m))))));
} else {
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((m_m * d_m) <= 1d+176) then
tmp = w0 * sqrt((1.0d0 - (((h * (m_m * (d_m * 0.5d0))) / d) / (l * ((d * 2.0d0) / (m_m * d_m))))))
else
tmp = w0 * sqrt((1.0d0 + (((h / l) * (m_m * (d_m * (0.5d0 / d)))) / (((-2.0d0) / d_m) / (m_m / d)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 1e+176) {
tmp = w0 * Math.sqrt((1.0 - (((h * (M_m * (D_m * 0.5))) / d) / (l * ((d * 2.0) / (M_m * D_m))))));
} else {
tmp = w0 * Math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (M_m * D_m) <= 1e+176: tmp = w0 * math.sqrt((1.0 - (((h * (M_m * (D_m * 0.5))) / d) / (l * ((d * 2.0) / (M_m * D_m)))))) else: tmp = w0 * math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(M_m * D_m) <= 1e+176) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / d) / Float64(l * Float64(Float64(d * 2.0) / Float64(M_m * D_m))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(Float64(-2.0 / D_m) / Float64(M_m / d)))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((M_m * D_m) <= 1e+176)
tmp = w0 * sqrt((1.0 - (((h * (M_m * (D_m * 0.5))) / d) / (l * ((d * 2.0) / (M_m * D_m))))));
else
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e+176], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / N[(l * N[(N[(d * 2.0), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-2.0 / D$95$m), $MachinePrecision] / N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{+176}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}}{\ell \cdot \frac{d \cdot 2}{M\_m \cdot D\_m}}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{\frac{\frac{-2}{D\_m}}{\frac{M\_m}{d}}}}\\
\end{array}
\end{array}
if (*.f64 M D) < 1e176Initial program 84.1%
Simplified84.5%
unpow284.5%
*-commutative84.5%
associate-*l/84.1%
associate-*r/83.3%
times-frac84.1%
clear-num84.1%
un-div-inv84.1%
*-commutative84.1%
associate-*l/84.1%
associate-*r/82.8%
times-frac84.1%
associate-/l*82.8%
div-inv82.8%
associate-/r*82.8%
metadata-eval82.8%
times-frac83.3%
Applied egg-rr83.3%
frac-times91.4%
associate-*r*90.9%
frac-times92.2%
Applied egg-rr92.2%
*-commutative92.2%
associate-*r/92.2%
associate-*r*92.2%
associate-*r/91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
if 1e176 < (*.f64 M D) Initial program 79.3%
Simplified79.3%
unpow279.3%
*-commutative79.3%
associate-*l/79.3%
associate-*r/79.3%
times-frac79.3%
clear-num79.3%
un-div-inv79.3%
*-commutative79.3%
associate-*l/79.3%
associate-*r/79.3%
times-frac79.3%
associate-/l*79.3%
div-inv79.3%
associate-/r*79.3%
metadata-eval79.3%
times-frac79.3%
Applied egg-rr79.3%
*-un-lft-identity79.3%
associate-*r*79.3%
frac-times79.3%
Applied egg-rr79.3%
*-lft-identity79.3%
sub-neg79.3%
associate-*l/79.3%
distribute-neg-frac279.3%
*-commutative79.3%
associate-*l*79.3%
associate-/l*79.3%
*-commutative79.3%
*-commutative79.3%
distribute-rgt-neg-in79.3%
metadata-eval79.3%
Simplified79.3%
clear-num79.3%
inv-pow79.3%
*-commutative79.3%
Applied egg-rr79.3%
unpow-179.3%
*-commutative79.3%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in D around 0 79.3%
associate-*r/79.3%
*-commutative79.3%
associate-*l/79.3%
associate-/r/79.3%
*-commutative79.3%
associate-/l*91.6%
associate-/r*91.7%
Simplified91.7%
Final simplification91.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (* M_m D_m) 5e-9)
(*
w0
(sqrt
(-
1.0
(/ (* h (/ (* (/ 0.5 d) (* M_m D_m)) (/ (* d 2.0) (* M_m D_m)))) l))))
(*
w0
(sqrt
(+
1.0
(/ (* (/ h l) (* M_m (* D_m (/ 0.5 d)))) (/ (/ -2.0 D_m) (/ M_m d))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 5e-9) {
tmp = w0 * sqrt((1.0 - ((h * (((0.5 / d) * (M_m * D_m)) / ((d * 2.0) / (M_m * D_m)))) / l)));
} else {
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((m_m * d_m) <= 5d-9) then
tmp = w0 * sqrt((1.0d0 - ((h * (((0.5d0 / d) * (m_m * d_m)) / ((d * 2.0d0) / (m_m * d_m)))) / l)))
else
tmp = w0 * sqrt((1.0d0 + (((h / l) * (m_m * (d_m * (0.5d0 / d)))) / (((-2.0d0) / d_m) / (m_m / d)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 5e-9) {
tmp = w0 * Math.sqrt((1.0 - ((h * (((0.5 / d) * (M_m * D_m)) / ((d * 2.0) / (M_m * D_m)))) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (M_m * D_m) <= 5e-9: tmp = w0 * math.sqrt((1.0 - ((h * (((0.5 / d) * (M_m * D_m)) / ((d * 2.0) / (M_m * D_m)))) / l))) else: tmp = w0 * math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(M_m * D_m) <= 5e-9) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(Float64(0.5 / d) * Float64(M_m * D_m)) / Float64(Float64(d * 2.0) / Float64(M_m * D_m)))) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(Float64(-2.0 / D_m) / Float64(M_m / d)))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((M_m * D_m) <= 5e-9)
tmp = w0 * sqrt((1.0 - ((h * (((0.5 / d) * (M_m * D_m)) / ((d * 2.0) / (M_m * D_m)))) / l)));
else
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 5e-9], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-2.0 / D$95$m), $MachinePrecision] / N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 5 \cdot 10^{-9}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \frac{\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)}{\frac{d \cdot 2}{M\_m \cdot D\_m}}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{\frac{\frac{-2}{D\_m}}{\frac{M\_m}{d}}}}\\
\end{array}
\end{array}
if (*.f64 M D) < 5.0000000000000001e-9Initial program 84.9%
Simplified85.4%
unpow285.4%
*-commutative85.4%
associate-*l/84.9%
associate-*r/84.0%
times-frac84.9%
clear-num84.9%
un-div-inv84.9%
*-commutative84.9%
associate-*l/84.9%
associate-*r/83.5%
times-frac84.9%
associate-/l*83.5%
div-inv83.5%
associate-/r*83.5%
metadata-eval83.5%
times-frac84.0%
Applied egg-rr84.0%
associate-*r/90.7%
associate-*r*90.7%
frac-times91.6%
Applied egg-rr91.6%
if 5.0000000000000001e-9 < (*.f64 M D) Initial program 78.1%
Simplified78.1%
unpow278.1%
*-commutative78.1%
associate-*l/78.1%
associate-*r/78.1%
times-frac78.1%
clear-num78.1%
un-div-inv78.1%
*-commutative78.1%
associate-*l/78.1%
associate-*r/78.1%
times-frac78.1%
associate-/l*78.1%
div-inv78.1%
associate-/r*78.1%
metadata-eval78.1%
times-frac78.1%
Applied egg-rr78.1%
*-un-lft-identity78.1%
associate-*r*78.1%
frac-times78.1%
Applied egg-rr78.1%
*-lft-identity78.1%
sub-neg78.1%
associate-*l/78.1%
distribute-neg-frac278.1%
*-commutative78.1%
associate-*l*78.1%
associate-/l*78.1%
*-commutative78.1%
*-commutative78.1%
distribute-rgt-neg-in78.1%
metadata-eval78.1%
Simplified78.1%
clear-num78.1%
inv-pow78.1%
*-commutative78.1%
Applied egg-rr78.1%
unpow-178.1%
*-commutative78.1%
associate-/l*84.0%
Simplified84.0%
Taylor expanded in D around 0 78.1%
associate-*r/78.1%
*-commutative78.1%
associate-*l/78.1%
associate-/r/78.1%
*-commutative78.1%
associate-/l*84.0%
associate-/r*84.0%
Simplified84.0%
Final simplification90.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (* M_m D_m) 4e-140)
w0
(*
w0
(sqrt
(+
1.0
(/ (* (/ h l) (* M_m (* D_m (/ 0.5 d)))) (/ (/ -2.0 D_m) (/ M_m d))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 4e-140) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((m_m * d_m) <= 4d-140) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 + (((h / l) * (m_m * (d_m * (0.5d0 / d)))) / (((-2.0d0) / d_m) / (m_m / d)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 4e-140) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (M_m * D_m) <= 4e-140: tmp = w0 else: tmp = w0 * math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(M_m * D_m) <= 4e-140) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(Float64(-2.0 / D_m) / Float64(M_m / d)))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((M_m * D_m) <= 4e-140)
tmp = w0;
else
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 4e-140], w0, N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-2.0 / D$95$m), $MachinePrecision] / N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 4 \cdot 10^{-140}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{\frac{\frac{-2}{D\_m}}{\frac{M\_m}{d}}}}\\
\end{array}
\end{array}
if (*.f64 M D) < 3.9999999999999999e-140Initial program 83.7%
Simplified84.2%
Taylor expanded in D around 0 80.1%
if 3.9999999999999999e-140 < (*.f64 M D) Initial program 83.6%
Simplified83.5%
unpow283.5%
*-commutative83.5%
associate-*l/83.6%
associate-*r/82.1%
times-frac83.6%
clear-num83.6%
un-div-inv83.6%
*-commutative83.6%
associate-*l/83.6%
associate-*r/82.1%
times-frac83.6%
associate-/l*82.1%
div-inv82.1%
associate-/r*82.1%
metadata-eval82.1%
times-frac82.1%
Applied egg-rr82.1%
*-un-lft-identity82.1%
associate-*r*83.6%
frac-times83.6%
Applied egg-rr83.6%
*-lft-identity83.6%
sub-neg83.6%
associate-*l/85.0%
distribute-neg-frac285.0%
*-commutative85.0%
associate-*l*83.5%
associate-/l*83.5%
*-commutative83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
metadata-eval83.5%
Simplified83.5%
clear-num83.6%
inv-pow83.6%
*-commutative83.6%
Applied egg-rr83.6%
unpow-183.6%
*-commutative83.6%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in D around 0 83.5%
associate-*r/83.5%
*-commutative83.5%
associate-*l/83.5%
associate-/r/83.6%
*-commutative83.6%
associate-/l*86.2%
associate-/r*86.2%
Simplified86.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (* M_m D_m) 4e-140)
w0
(*
w0
(sqrt
(+
1.0
(/ (* (/ h l) (* M_m (* D_m (/ 0.5 d)))) (* -2.0 (/ d (* M_m D_m)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 4e-140) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / (-2.0 * (d / (M_m * D_m))))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((m_m * d_m) <= 4d-140) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 + (((h / l) * (m_m * (d_m * (0.5d0 / d)))) / ((-2.0d0) * (d / (m_m * d_m))))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 4e-140) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / (-2.0 * (d / (M_m * D_m))))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (M_m * D_m) <= 4e-140: tmp = w0 else: tmp = w0 * math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / (-2.0 * (d / (M_m * D_m)))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(M_m * D_m) <= 4e-140) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(-2.0 * Float64(d / Float64(M_m * D_m))))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((M_m * D_m) <= 4e-140)
tmp = w0;
else
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / (-2.0 * (d / (M_m * D_m))))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 4e-140], w0, N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-2.0 * N[(d / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 4 \cdot 10^{-140}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{-2 \cdot \frac{d}{M\_m \cdot D\_m}}}\\
\end{array}
\end{array}
if (*.f64 M D) < 3.9999999999999999e-140Initial program 83.7%
Simplified84.2%
Taylor expanded in D around 0 80.1%
if 3.9999999999999999e-140 < (*.f64 M D) Initial program 83.6%
Simplified83.5%
unpow283.5%
*-commutative83.5%
associate-*l/83.6%
associate-*r/82.1%
times-frac83.6%
clear-num83.6%
un-div-inv83.6%
*-commutative83.6%
associate-*l/83.6%
associate-*r/82.1%
times-frac83.6%
associate-/l*82.1%
div-inv82.1%
associate-/r*82.1%
metadata-eval82.1%
times-frac82.1%
Applied egg-rr82.1%
*-un-lft-identity82.1%
associate-*r*83.6%
frac-times83.6%
Applied egg-rr83.6%
*-lft-identity83.6%
sub-neg83.6%
associate-*l/85.0%
distribute-neg-frac285.0%
*-commutative85.0%
associate-*l*83.5%
associate-/l*83.5%
*-commutative83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
metadata-eval83.5%
Simplified83.5%
Final simplification81.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= M_m 0.00016)
(*
w0
(sqrt
(+
1.0
(/ (/ (* h (* 0.5 (* M_m D_m))) (* l d)) (* -2.0 (/ d (* M_m D_m)))))))
(*
w0
(sqrt
(+
1.0
(/ (* (/ h l) (* M_m (* D_m (/ 0.5 d)))) (/ (/ -2.0 D_m) (/ M_m d))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 0.00016) {
tmp = w0 * sqrt((1.0 + (((h * (0.5 * (M_m * D_m))) / (l * d)) / (-2.0 * (d / (M_m * D_m))))));
} else {
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 (m_m <= 0.00016d0) then
tmp = w0 * sqrt((1.0d0 + (((h * (0.5d0 * (m_m * d_m))) / (l * d)) / ((-2.0d0) * (d / (m_m * d_m))))))
else
tmp = w0 * sqrt((1.0d0 + (((h / l) * (m_m * (d_m * (0.5d0 / d)))) / (((-2.0d0) / d_m) / (m_m / d)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 0.00016) {
tmp = w0 * Math.sqrt((1.0 + (((h * (0.5 * (M_m * D_m))) / (l * d)) / (-2.0 * (d / (M_m * D_m))))));
} else {
tmp = w0 * Math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if M_m <= 0.00016: tmp = w0 * math.sqrt((1.0 + (((h * (0.5 * (M_m * D_m))) / (l * d)) / (-2.0 * (d / (M_m * D_m)))))) else: tmp = w0 * math.sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 0.00016) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h * Float64(0.5 * Float64(M_m * D_m))) / Float64(l * d)) / Float64(-2.0 * Float64(d / Float64(M_m * D_m))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * Float64(0.5 / d)))) / Float64(Float64(-2.0 / D_m) / Float64(M_m / d)))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if (M_m <= 0.00016)
tmp = w0 * sqrt((1.0 + (((h * (0.5 * (M_m * D_m))) / (l * d)) / (-2.0 * (d / (M_m * D_m))))));
else
tmp = w0 * sqrt((1.0 + (((h / l) * (M_m * (D_m * (0.5 / d)))) / ((-2.0 / D_m) / (M_m / d)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[M$95$m, 0.00016], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h * N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] / N[(-2.0 * N[(d / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-2.0 / D$95$m), $MachinePrecision] / N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 0.00016:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h \cdot \left(0.5 \cdot \left(M\_m \cdot D\_m\right)\right)}{\ell \cdot d}}{-2 \cdot \frac{d}{M\_m \cdot D\_m}}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right)}{\frac{\frac{-2}{D\_m}}{\frac{M\_m}{d}}}}\\
\end{array}
\end{array}
if M < 1.60000000000000013e-4Initial program 85.4%
Simplified85.4%
unpow285.4%
*-commutative85.4%
associate-*l/85.4%
associate-*r/84.4%
times-frac85.4%
clear-num85.4%
un-div-inv85.4%
*-commutative85.4%
associate-*l/85.4%
associate-*r/84.4%
times-frac85.4%
associate-/l*84.4%
div-inv84.4%
associate-/r*84.4%
metadata-eval84.4%
times-frac84.5%
Applied egg-rr84.5%
*-un-lft-identity84.5%
associate-*r*85.0%
frac-times85.4%
Applied egg-rr85.4%
*-lft-identity85.4%
sub-neg85.4%
associate-*l/86.9%
distribute-neg-frac286.9%
*-commutative86.9%
associate-*l*85.4%
associate-/l*85.4%
*-commutative85.4%
*-commutative85.4%
distribute-rgt-neg-in85.4%
metadata-eval85.4%
Simplified85.4%
Taylor expanded in h around 0 87.4%
associate-*r/87.4%
associate-*r*87.4%
*-commutative87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l*90.3%
associate-*r*90.3%
*-commutative90.3%
*-commutative90.3%
Simplified90.3%
if 1.60000000000000013e-4 < M Initial program 77.2%
Simplified78.9%
unpow278.9%
*-commutative78.9%
associate-*l/77.2%
associate-*r/77.3%
times-frac77.2%
clear-num77.2%
un-div-inv77.2%
*-commutative77.2%
associate-*l/77.2%
associate-*r/75.5%
times-frac77.2%
associate-/l*75.5%
div-inv75.5%
associate-/r*75.5%
metadata-eval75.5%
times-frac77.3%
Applied egg-rr77.3%
*-un-lft-identity77.3%
associate-*r*75.5%
frac-times77.2%
Applied egg-rr77.2%
*-lft-identity77.2%
sub-neg77.2%
associate-*l/82.5%
distribute-neg-frac282.5%
*-commutative82.5%
associate-*l*80.8%
associate-/l*80.8%
*-commutative80.8%
*-commutative80.8%
distribute-rgt-neg-in80.8%
metadata-eval80.8%
Simplified80.8%
clear-num80.8%
inv-pow80.8%
*-commutative80.8%
Applied egg-rr80.8%
unpow-180.8%
*-commutative80.8%
associate-/l*82.6%
Simplified82.6%
Taylor expanded in D around 0 80.8%
associate-*r/80.8%
*-commutative80.8%
associate-*l/80.8%
associate-/r/80.8%
*-commutative80.8%
associate-/l*82.6%
associate-/r*82.7%
Simplified82.7%
Final simplification88.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (/ h l) -1e-298)
(*
w0
(sqrt
(- 1.0 (* (/ h l) (* 0.25 (/ (/ (* M_m D_m) d) (/ d (* M_m D_m))))))))
w0))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-298) {
tmp = w0 * sqrt((1.0 - ((h / l) * (0.25 * (((M_m * D_m) / d) / (d / (M_m * D_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((h / l) <= (-1d-298)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (0.25d0 * (((m_m * d_m) / d) / (d / (m_m * d_m)))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-298) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (0.25 * (((M_m * D_m) / d) / (d / (M_m * D_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -1e-298: tmp = w0 * math.sqrt((1.0 - ((h / l) * (0.25 * (((M_m * D_m) / d) / (d / (M_m * D_m))))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e-298) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(0.25 * Float64(Float64(Float64(M_m * D_m) / d) / Float64(d / Float64(M_m * D_m)))))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -1e-298)
tmp = w0 * sqrt((1.0 - ((h / l) * (0.25 * (((M_m * D_m) / d) / (d / (M_m * D_m)))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-298], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.25 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] / N[(d / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-298}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(0.25 \cdot \frac{\frac{M\_m \cdot D\_m}{d}}{\frac{d}{M\_m \cdot D\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.99999999999999912e-299Initial program 81.0%
Simplified81.0%
unpow281.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/79.8%
times-frac81.0%
clear-num81.0%
un-div-inv81.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/79.8%
times-frac81.0%
associate-/l*79.8%
div-inv79.8%
associate-/r*79.8%
metadata-eval79.8%
times-frac79.8%
Applied egg-rr79.8%
associate-*r/86.9%
associate-*r*86.9%
frac-times88.1%
Applied egg-rr88.1%
*-un-lft-identity88.1%
associate-/l*81.0%
associate-/l*79.1%
*-commutative79.1%
associate-/l*79.1%
associate-/r*78.6%
Applied egg-rr78.6%
*-lft-identity78.6%
*-commutative78.6%
associate-*r/79.8%
associate-*r/79.8%
associate-*l/79.8%
*-commutative79.8%
*-commutative79.8%
times-frac79.8%
metadata-eval79.8%
associate-/l*79.8%
associate-/r*81.0%
Simplified81.0%
associate-*r/81.0%
*-commutative81.0%
Applied egg-rr81.0%
if -9.99999999999999912e-299 < (/.f64 h l) Initial program 87.5%
Simplified88.5%
Taylor expanded in D around 0 97.0%
Final simplification87.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (/ h l) -1e-298)
(*
w0
(sqrt
(- 1.0 (* (/ h l) (* 0.25 (/ (* D_m (/ M_m d)) (/ d (* M_m D_m))))))))
w0))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-298) {
tmp = w0 * sqrt((1.0 - ((h / l) * (0.25 * ((D_m * (M_m / d)) / (d / (M_m * D_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((h / l) <= (-1d-298)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (0.25d0 * ((d_m * (m_m / d)) / (d / (m_m * d_m)))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-298) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (0.25 * ((D_m * (M_m / d)) / (d / (M_m * D_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -1e-298: tmp = w0 * math.sqrt((1.0 - ((h / l) * (0.25 * ((D_m * (M_m / d)) / (d / (M_m * D_m))))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e-298) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(0.25 * Float64(Float64(D_m * Float64(M_m / d)) / Float64(d / Float64(M_m * D_m)))))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -1e-298)
tmp = w0 * sqrt((1.0 - ((h / l) * (0.25 * ((D_m * (M_m / d)) / (d / (M_m * D_m)))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-298], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.25 * N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / N[(d / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-298}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(0.25 \cdot \frac{D\_m \cdot \frac{M\_m}{d}}{\frac{d}{M\_m \cdot D\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.99999999999999912e-299Initial program 81.0%
Simplified81.0%
unpow281.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/79.8%
times-frac81.0%
clear-num81.0%
un-div-inv81.0%
*-commutative81.0%
associate-*l/81.0%
associate-*r/79.8%
times-frac81.0%
associate-/l*79.8%
div-inv79.8%
associate-/r*79.8%
metadata-eval79.8%
times-frac79.8%
Applied egg-rr79.8%
associate-*r/86.9%
associate-*r*86.9%
frac-times88.1%
Applied egg-rr88.1%
*-un-lft-identity88.1%
associate-/l*81.0%
associate-/l*79.1%
*-commutative79.1%
associate-/l*79.1%
associate-/r*78.6%
Applied egg-rr78.6%
*-lft-identity78.6%
*-commutative78.6%
associate-*r/79.8%
associate-*r/79.8%
associate-*l/79.8%
*-commutative79.8%
*-commutative79.8%
times-frac79.8%
metadata-eval79.8%
associate-/l*79.8%
associate-/r*81.0%
Simplified81.0%
if -9.99999999999999912e-299 < (/.f64 h l) Initial program 87.5%
Simplified88.5%
Taylor expanded in D around 0 97.0%
Final simplification87.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (if (<= (* M_m D_m) 2e+161) w0 (* -0.125 (* (* (* M_m D_m) (* M_m D_m)) (* (/ h l) (/ w0 (pow d 2.0)))))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 2e+161) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h / l) * (w0 / pow(d, 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 ((m_m * d_m) <= 2d+161) then
tmp = w0
else
tmp = (-0.125d0) * (((m_m * d_m) * (m_m * d_m)) * ((h / l) * (w0 / (d ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((M_m * D_m) <= 2e+161) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h / l) * (w0 / Math.pow(d, 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (M_m * D_m) <= 2e+161: tmp = w0 else: tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h / l) * (w0 / math.pow(d, 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(M_m * D_m) <= 2e+161) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(Float64(h / l) * Float64(w0 / (d ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((M_m * D_m) <= 2e+161)
tmp = w0;
else
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h / l) * (w0 / (d ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e+161], w0, N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(w0 / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+161}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(\frac{h}{\ell} \cdot \frac{w0}{{d}^{2}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 2.0000000000000001e161Initial program 84.7%
Simplified85.1%
Taylor expanded in D around 0 78.1%
if 2.0000000000000001e161 < (*.f64 M D) Initial program 74.2%
Simplified74.2%
unpow274.2%
unpow274.2%
*-commutative74.2%
associate-*l/74.2%
associate-*r/74.2%
times-frac74.2%
associate-*r/74.4%
*-commutative74.4%
associate-/l*74.4%
div-inv74.4%
associate-/r*74.4%
metadata-eval74.4%
Applied egg-rr74.4%
Taylor expanded in h around 0 65.7%
+-commutative65.7%
fma-define65.7%
associate-*r*65.9%
unpow265.9%
unpow265.9%
swap-sqr65.9%
unpow265.9%
*-commutative65.9%
Simplified65.9%
Taylor expanded in D around inf 65.7%
associate-*r*65.9%
*-commutative65.9%
unpow265.9%
unpow265.9%
swap-sqr65.9%
unpow265.9%
*-commutative65.9%
associate-*r/65.7%
*-commutative65.7%
times-frac73.9%
Simplified73.9%
*-commutative73.9%
pow273.9%
Applied egg-rr73.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (if (<= M_m 1650.0) w0 (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (* h (/ w0 l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 1650.0) {
tmp = w0;
} else {
tmp = -0.125 * (pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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 (m_m <= 1650.0d0) then
tmp = w0
else
tmp = (-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (h * (w0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 1650.0) {
tmp = w0;
} else {
tmp = -0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if M_m <= 1650.0: tmp = w0 else: tmp = -0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 1650.0) tmp = w0; else tmp = Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(h * Float64(w0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if (M_m <= 1650.0)
tmp = w0;
else
tmp = -0.125 * (((D_m * (M_m / d)) ^ 2.0) * (h * (w0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[M$95$m, 1650.0], w0, N[(-0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 1650:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 1650Initial program 85.5%
Simplified85.5%
Taylor expanded in D around 0 76.5%
if 1650 < M Initial program 76.8%
Simplified78.5%
unpow278.5%
unpow278.5%
*-commutative78.5%
associate-*l/76.8%
associate-*r/76.8%
times-frac76.8%
associate-*r/82.3%
*-commutative82.3%
associate-/l*82.4%
div-inv82.4%
associate-/r*82.4%
metadata-eval82.4%
Applied egg-rr82.4%
Taylor expanded in h around 0 40.0%
+-commutative40.0%
fma-define40.0%
associate-*r*43.6%
unpow243.6%
unpow243.6%
swap-sqr58.6%
unpow258.6%
*-commutative58.6%
Simplified58.6%
Taylor expanded in D around inf 27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
unpow227.6%
swap-sqr30.3%
unpow230.3%
*-commutative30.3%
associate-*r/30.2%
*-commutative30.2%
times-frac31.9%
Simplified31.9%
Taylor expanded in D around 0 27.6%
associate-*r*27.6%
times-frac29.3%
*-commutative29.3%
associate-/l*27.2%
unpow227.2%
unpow227.2%
unpow227.2%
times-frac29.3%
swap-sqr32.4%
associate-/l*32.3%
associate-/l*32.4%
unpow232.4%
*-commutative32.4%
associate-/l*32.5%
associate-/l*32.3%
Simplified32.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_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
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) return w0 end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
w0
\end{array}
Initial program 83.7%
Simplified84.0%
Taylor expanded in D around 0 71.0%
herbie shell --seed 2024143
(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))))))