
(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 10 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 (- 1.0 (* (pow (/ (* M_m D) (* 2.0 d)) 2.0) (/ h l)))))
(if (<= t_0 5e+183)
(* w0 (sqrt t_0))
(*
w0
(sqrt
(- 1.0 (* (/ (/ M_m 4.0) (/ l (* h (* D (/ M_m d))))) (/ D d))))))))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(((M_m * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+183) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
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 - ((((m_m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+183) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (((m_m / 4.0d0) / (l / (h * (d * (m_m / d_1))))) * (d / d_1))))
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(((M_m * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+183) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
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(((M_m * D) / (2.0 * d)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+183: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d)))) 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(M_m * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+183) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M_m / 4.0) / Float64(l / Float64(h * Float64(D * Float64(M_m / d))))) * Float64(D / d))))); 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 - ((((M_m * D) / (2.0 * d)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 5e+183)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
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[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+183], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M$95$m / 4.0), $MachinePrecision] / N[(l / N[(h * N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D / d), $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{M_m \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+183}:\\
\;\;\;\;w0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{M_m}{4}}{\frac{\ell}{h \cdot \left(D \cdot \frac{M_m}{d}\right)}} \cdot \frac{D}{d}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 5.00000000000000009e183Initial program 99.9%
if 5.00000000000000009e183 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 54.1%
associate-/l*58.4%
clear-num58.3%
associate-/r/58.4%
associate-/r/58.4%
associate-/r*58.4%
metadata-eval58.4%
Applied egg-rr58.4%
Applied egg-rr59.8%
div-inv59.8%
*-commutative59.8%
clear-num59.8%
associate-/r*59.8%
associate-/l/71.6%
*-commutative71.6%
associate-/r/68.5%
*-commutative68.5%
Applied egg-rr68.5%
Final simplification88.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
(if (<= (/ h l) -4e-318)
(*
w0
(sqrt (- 1.0 (* D (* (/ M_m d) (* 0.25 (* (/ h l) (* D (/ M_m 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) <= -4e-318) {
tmp = w0 * sqrt((1.0 - (D * ((M_m / d) * (0.25 * ((h / l) * (D * (M_m / 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) <= (-4d-318)) then
tmp = w0 * sqrt((1.0d0 - (d * ((m_m / d_1) * (0.25d0 * ((h / l) * (d * (m_m / 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) <= -4e-318) {
tmp = w0 * Math.sqrt((1.0 - (D * ((M_m / d) * (0.25 * ((h / l) * (D * (M_m / 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) <= -4e-318: tmp = w0 * math.sqrt((1.0 - (D * ((M_m / d) * (0.25 * ((h / l) * (D * (M_m / 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) <= -4e-318) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(D * Float64(Float64(M_m / d) * Float64(0.25 * Float64(Float64(h / l) * Float64(D * Float64(M_m / 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) <= -4e-318)
tmp = w0 * sqrt((1.0 - (D * ((M_m / d) * (0.25 * ((h / l) * (D * (M_m / 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], -4e-318], N[(w0 * N[Sqrt[N[(1.0 - N[(D * N[(N[(M$95$m / d), $MachinePrecision] * N[(0.25 * N[(N[(h / l), $MachinePrecision] * N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $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 -4 \cdot 10^{-318}:\\
\;\;\;\;w0 \cdot \sqrt{1 - D \cdot \left(\frac{M_m}{d} \cdot \left(0.25 \cdot \left(\frac{h}{\ell} \cdot \left(D \cdot \frac{M_m}{d}\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -3.9999999e-318Initial program 82.5%
associate-/l*83.8%
clear-num83.8%
associate-/r/83.8%
associate-/r/83.7%
associate-/r*83.7%
metadata-eval83.7%
Applied egg-rr83.7%
Applied egg-rr81.9%
associate-/r/83.8%
associate-*l/85.0%
*-commutative85.0%
clear-num85.0%
div-inv85.0%
clear-num84.4%
associate-/l/84.7%
un-div-inv84.7%
associate-/l*84.7%
*-commutative84.7%
div-inv84.7%
*-commutative84.7%
associate-*l*84.7%
associate-/r/82.6%
*-commutative82.6%
Applied egg-rr80.7%
associate-*l*78.2%
*-commutative78.2%
associate-*r*80.1%
associate-*r/78.8%
associate-*l/80.7%
associate-/r/80.1%
associate-/r/79.0%
associate-/l*77.0%
associate-*r/76.3%
*-commutative76.3%
associate-/r*75.6%
times-frac80.1%
associate-/r/80.7%
*-commutative80.7%
Simplified80.7%
if -3.9999999e-318 < (/.f64 h l) Initial program 85.3%
Simplified86.3%
Taylor expanded in M around 0 94.4%
Final simplification86.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
(if (<= (* M_m D) 2.5e-290)
w0
(*
w0
(sqrt (- 1.0 (* (/ (* M_m D) (* d 4.0)) (/ (* (* M_m D) (/ h 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 ((M_m * D) <= 2.5e-290) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / 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 ((m_m * d) <= 2.5d-290) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - (((m_m * d) / (d_1 * 4.0d0)) * (((m_m * d) * (h / d_1)) / 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 ((M_m * D) <= 2.5e-290) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / 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 (M_m * D) <= 2.5e-290: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / 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 (Float64(M_m * D) <= 2.5e-290) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M_m * D) / Float64(d * 4.0)) * Float64(Float64(Float64(M_m * D) * Float64(h / 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 ((M_m * D) <= 2.5e-290)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / 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[N[(M$95$m * D), $MachinePrecision], 2.5e-290], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M$95$m * D), $MachinePrecision] / N[(d * 4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * D), $MachinePrecision] * N[(h / d), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \cdot D \leq 2.5 \cdot 10^{-290}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{M_m \cdot D}{d \cdot 4} \cdot \frac{\left(M_m \cdot D\right) \cdot \frac{h}{d}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 M D) < 2.5e-290Initial program 83.1%
Simplified83.9%
Taylor expanded in M around 0 66.8%
if 2.5e-290 < (*.f64 M D) Initial program 84.2%
associate-/l*85.9%
clear-num85.9%
associate-/r/85.8%
associate-/r/85.8%
associate-/r*85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Applied egg-rr85.0%
div-inv84.3%
*-commutative84.3%
clear-num84.3%
associate-/r*84.3%
associate-/l/87.7%
*-commutative87.7%
associate-/r/86.1%
*-commutative86.1%
Applied egg-rr86.1%
associate-/l/86.1%
clear-num86.1%
frac-times89.4%
*-commutative89.4%
*-un-lft-identity89.4%
clear-num89.4%
associate-*l/89.4%
metadata-eval89.4%
clear-num89.4%
associate-/r*86.8%
associate-/r/85.9%
clear-num85.9%
associate-*r/85.1%
*-commutative85.1%
Applied egg-rr85.1%
*-commutative85.1%
associate-/r*85.1%
associate-/l*85.1%
associate-/r/85.1%
associate-/l/85.1%
*-commutative85.1%
associate-*l/89.3%
associate-*r/86.2%
associate-/l*89.4%
associate-/r/88.5%
*-commutative88.5%
Simplified88.5%
Final simplification76.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 4.8e-158) w0 (+ w0 (* -0.125 (/ (* (/ D d) (* h (* w0 (pow M_m 2.0)))) (* l (/ d D)))))))
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 <= 4.8e-158) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * pow(M_m, 2.0)))) / (l * (d / D))));
}
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 <= 4.8d-158) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d / d_1) * (h * (w0 * (m_m ** 2.0d0)))) / (l * (d_1 / d))))
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 <= 4.8e-158) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * Math.pow(M_m, 2.0)))) / (l * (d / D))));
}
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 <= 4.8e-158: tmp = w0 else: tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * math.pow(M_m, 2.0)))) / (l * (d / D)))) 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 <= 4.8e-158) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(h * Float64(w0 * (M_m ^ 2.0)))) / Float64(l * Float64(d / D))))); 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 <= 4.8e-158)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * (M_m ^ 2.0)))) / (l * (d / D))));
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, 4.8e-158], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(h * N[(w0 * N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d / D), $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 4.8 \cdot 10^{-158}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{\frac{D}{d} \cdot \left(h \cdot \left(w0 \cdot {M_m}^{2}\right)\right)}{\ell \cdot \frac{d}{D}}\\
\end{array}
\end{array}
if M < 4.80000000000000015e-158Initial program 82.2%
Simplified83.5%
Taylor expanded in M around 0 66.8%
if 4.80000000000000015e-158 < M Initial program 86.0%
Simplified86.9%
associate-*r/88.0%
times-frac87.1%
associate-/l*85.9%
unpow285.9%
times-frac85.9%
associate-*l/85.9%
times-frac86.9%
associate-*l/86.9%
frac-times86.9%
associate-/l/86.9%
metadata-eval86.9%
Applied egg-rr86.9%
Taylor expanded in M around 0 52.1%
times-frac52.2%
unpow252.2%
unpow252.2%
times-frac67.7%
unpow267.7%
Simplified67.7%
unpow267.7%
associate-*r/67.7%
Applied egg-rr67.7%
associate-/l*67.7%
frac-times69.0%
*-commutative69.0%
associate-*l*69.1%
Applied egg-rr69.1%
Final simplification67.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 (* (/ (/ M_m 4.0) (/ l (* h (* D (/ M_m d))))) (/ D d))))))
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 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
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 - (((m_m / 4.0d0) / (l / (h * (d * (m_m / d_1))))) * (d / d_1))))
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 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
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 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))))
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(Float64(M_m / 4.0) / Float64(l / Float64(h * Float64(D * Float64(M_m / d))))) * Float64(D / d))))) 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 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
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[(N[(M$95$m / 4.0), $MachinePrecision] / N[(l / N[(h * N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D / d), $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 - \frac{\frac{M_m}{4}}{\frac{\ell}{h \cdot \left(D \cdot \frac{M_m}{d}\right)}} \cdot \frac{D}{d}}
\end{array}
Initial program 83.6%
associate-/l*84.8%
clear-num84.8%
associate-/r/84.8%
associate-/r/84.8%
associate-/r*84.8%
metadata-eval84.8%
Applied egg-rr84.8%
Applied egg-rr84.9%
div-inv84.5%
*-commutative84.5%
clear-num84.5%
associate-/r*84.5%
associate-/l/88.8%
*-commutative88.8%
associate-/r/86.1%
*-commutative86.1%
Applied egg-rr86.1%
Final simplification86.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 (* -0.125 (/ (/ D d) (* (/ l (* h (* w0 (pow M_m 2.0)))) (/ d D))))))
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 + (-0.125 * ((D / d) / ((l / (h * (w0 * pow(M_m, 2.0)))) * (d / D))));
}
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 + ((-0.125d0) * ((d / d_1) / ((l / (h * (w0 * (m_m ** 2.0d0)))) * (d_1 / d))))
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 + (-0.125 * ((D / d) / ((l / (h * (w0 * Math.pow(M_m, 2.0)))) * (d / D))));
}
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 + (-0.125 * ((D / d) / ((l / (h * (w0 * math.pow(M_m, 2.0)))) * (d / D))))
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 + Float64(-0.125 * Float64(Float64(D / d) / Float64(Float64(l / Float64(h * Float64(w0 * (M_m ^ 2.0)))) * Float64(d / D))))) 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 + (-0.125 * ((D / d) / ((l / (h * (w0 * (M_m ^ 2.0)))) * (d / D))));
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[(-0.125 * N[(N[(D / d), $MachinePrecision] / N[(N[(l / N[(h * N[(w0 * N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / D), $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 + -0.125 \cdot \frac{\frac{D}{d}}{\frac{\ell}{h \cdot \left(w0 \cdot {M_m}^{2}\right)} \cdot \frac{d}{D}}
\end{array}
Initial program 83.6%
Simplified84.8%
associate-*r/86.8%
times-frac86.1%
associate-/l*84.0%
unpow284.0%
times-frac83.6%
associate-*l/83.6%
times-frac85.1%
associate-*l/85.1%
frac-times85.1%
associate-/l/85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in M around 0 48.9%
times-frac49.8%
unpow249.8%
unpow249.8%
times-frac62.1%
unpow262.1%
Simplified62.1%
unpow262.1%
associate-*r/61.7%
Applied egg-rr61.7%
*-commutative61.7%
clear-num61.6%
associate-/l*62.1%
frac-times65.5%
*-un-lft-identity65.5%
*-commutative65.5%
associate-*l*69.9%
Applied egg-rr69.9%
Final simplification69.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 (<= M_m 2.25e-166) w0 (+ w0 (* -0.125 (* (* h w0) (/ (* D (* (/ M_m d) (/ (* 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 (M_m <= 2.25e-166) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((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 (m_m <= 2.25d-166) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((h * w0) * ((d * ((m_m / d_1) * ((m_m * d) / d_1))) / 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 (M_m <= 2.25e-166) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((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 M_m <= 2.25e-166: tmp = w0 else: tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((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 (M_m <= 2.25e-166) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * w0) * Float64(Float64(D * Float64(Float64(M_m / d) * Float64(Float64(M_m * D) / 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 (M_m <= 2.25e-166)
tmp = w0;
else
tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((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[M$95$m, 2.25e-166], w0, N[(w0 + N[(-0.125 * N[(N[(h * w0), $MachinePrecision] * N[(N[(D * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(M$95$m * D), $MachinePrecision] / d), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \leq 2.25 \cdot 10^{-166}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot w0\right) \cdot \frac{D \cdot \left(\frac{M_m}{d} \cdot \frac{M_m \cdot D}{d}\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 2.2499999999999999e-166Initial program 82.0%
Simplified83.3%
Taylor expanded in M around 0 67.0%
if 2.2499999999999999e-166 < M Initial program 86.2%
Simplified87.2%
associate-*r/88.3%
times-frac87.3%
associate-/l*86.2%
unpow286.2%
times-frac86.2%
associate-*l/86.2%
times-frac87.1%
associate-*l/87.1%
frac-times87.1%
associate-/l/87.1%
metadata-eval87.1%
Applied egg-rr87.1%
Taylor expanded in M around 0 52.0%
times-frac52.2%
unpow252.2%
unpow252.2%
times-frac67.3%
unpow267.3%
Simplified67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*l/68.3%
unpow268.3%
unpow268.3%
swap-sqr72.7%
clear-num72.7%
div-inv72.7%
clear-num72.7%
div-inv72.7%
pow172.7%
pow172.7%
pow-sqr72.7%
associate-/r/71.7%
*-commutative71.7%
metadata-eval71.7%
Applied egg-rr71.7%
associate-/r/74.6%
Simplified74.6%
unpow274.6%
*-commutative74.6%
associate-*r*71.7%
associate-*r/71.6%
*-commutative71.6%
Applied egg-rr71.6%
Final simplification68.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 (let* ((t_0 (/ (* M_m D) d))) (if (<= M_m 1.6e-165) w0 (+ w0 (* -0.125 (* (* h w0) (/ (* 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) / d;
double tmp;
if (M_m <= 1.6e-165) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * w0) * ((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) / d_1
if (m_m <= 1.6d-165) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((h * w0) * ((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) / d;
double tmp;
if (M_m <= 1.6e-165) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * w0) * ((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) / d tmp = 0 if M_m <= 1.6e-165: tmp = w0 else: tmp = w0 + (-0.125 * ((h * w0) * ((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 * D) / d) tmp = 0.0 if (M_m <= 1.6e-165) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * w0) * Float64(Float64(t_0 * 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) / d;
tmp = 0.0;
if (M_m <= 1.6e-165)
tmp = w0;
else
tmp = w0 + (-0.125 * ((h * w0) * ((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 * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 1.6e-165], w0, N[(w0 + N[(-0.125 * N[(N[(h * w0), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $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])\\
\\
\begin{array}{l}
t_0 := \frac{M_m \cdot D}{d}\\
\mathbf{if}\;M_m \leq 1.6 \cdot 10^{-165}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot w0\right) \cdot \frac{t_0 \cdot t_0}{\ell}\right)\\
\end{array}
\end{array}
if M < 1.60000000000000006e-165Initial program 82.0%
Simplified83.3%
Taylor expanded in M around 0 67.0%
if 1.60000000000000006e-165 < M Initial program 86.2%
Simplified87.2%
associate-*r/88.3%
times-frac87.3%
associate-/l*86.2%
unpow286.2%
times-frac86.2%
associate-*l/86.2%
times-frac87.1%
associate-*l/87.1%
frac-times87.1%
associate-/l/87.1%
metadata-eval87.1%
Applied egg-rr87.1%
Taylor expanded in M around 0 52.0%
times-frac52.2%
unpow252.2%
unpow252.2%
times-frac67.3%
unpow267.3%
Simplified67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*l/68.3%
unpow268.3%
unpow268.3%
swap-sqr72.7%
clear-num72.7%
div-inv72.7%
clear-num72.7%
div-inv72.7%
pow172.7%
pow172.7%
pow-sqr72.7%
associate-/r/71.7%
*-commutative71.7%
metadata-eval71.7%
Applied egg-rr71.7%
associate-/r/74.6%
Simplified74.6%
unpow274.6%
associate-*r/74.6%
associate-*r/75.6%
*-commutative75.6%
*-commutative75.6%
Applied egg-rr75.6%
Final simplification70.3%
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) d))) (if (<= M_m 4e-222) w0 (+ w0 (* -0.125 (* (* t_0 (/ t_0 l)) (* h 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 t_0 = (M_m * D) / d;
double tmp;
if (M_m <= 4e-222) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * 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) :: t_0
real(8) :: tmp
t_0 = (m_m * d) / d_1
if (m_m <= 4d-222) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((t_0 * (t_0 / l)) * (h * 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 t_0 = (M_m * D) / d;
double tmp;
if (M_m <= 4e-222) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * 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): t_0 = (M_m * D) / d tmp = 0 if M_m <= 4e-222: tmp = w0 else: tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * 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) t_0 = Float64(Float64(M_m * D) / d) tmp = 0.0 if (M_m <= 4e-222) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(t_0 * Float64(t_0 / l)) * Float64(h * 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)
t_0 = (M_m * D) / d;
tmp = 0.0;
if (M_m <= 4e-222)
tmp = w0;
else
tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * 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_] := Block[{t$95$0 = N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 4e-222], w0, N[(w0 + N[(-0.125 * N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * w0), $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 := \frac{M_m \cdot D}{d}\\
\mathbf{if}\;M_m \leq 4 \cdot 10^{-222}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(t_0 \cdot \frac{t_0}{\ell}\right) \cdot \left(h \cdot w0\right)\right)\\
\end{array}
\end{array}
if M < 4.00000000000000019e-222Initial program 80.5%
Simplified81.9%
Taylor expanded in M around 0 64.9%
if 4.00000000000000019e-222 < M Initial program 87.7%
Simplified88.6%
associate-*r/89.5%
times-frac88.7%
associate-/l*87.7%
unpow287.7%
times-frac87.7%
associate-*l/87.7%
times-frac88.5%
associate-*l/88.5%
frac-times88.5%
associate-/l/88.5%
metadata-eval88.5%
Applied egg-rr88.5%
Taylor expanded in M around 0 51.8%
times-frac52.8%
unpow252.8%
unpow252.8%
times-frac69.1%
unpow269.1%
Simplified69.1%
*-commutative69.1%
associate-/l*68.1%
associate-*l/69.0%
unpow269.0%
unpow269.0%
swap-sqr73.9%
clear-num73.9%
div-inv73.9%
clear-num73.9%
div-inv73.9%
pow173.9%
pow173.9%
pow-sqr73.9%
associate-/r/73.0%
*-commutative73.0%
metadata-eval73.0%
Applied egg-rr73.0%
associate-/r/76.5%
Simplified76.5%
unpow276.5%
*-un-lft-identity76.5%
times-frac78.3%
associate-*r/77.4%
*-commutative77.4%
associate-*r/79.2%
*-commutative79.2%
Applied egg-rr79.2%
Final simplification71.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)
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 83.6%
Simplified84.8%
Taylor expanded in M around 0 63.8%
Final simplification63.8%
herbie shell --seed 2023336
(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))))))