
(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 12 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)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
(if (<= t_0 0.0001)
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (* D_m (/ 0.5 d_m))) 2.0) l)))))
(if (<= t_0 4e+153)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ d_m M_m) (/ 2.0 D_m)) -2.0)))))
(*
w0
(sqrt
(-
1.0
(/ (* (/ 0.25 l) (* h (pow (* M_m D_m) 2.0))) (pow d_m 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * D_m) / (2.0 * d_m);
double tmp;
if (t_0 <= 0.0001) {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
} else if (t_0 <= 4e+153) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((d_m / M_m) * (2.0 / D_m)), -2.0))));
} else {
tmp = w0 * sqrt((1.0 - (((0.25 / l) * (h * pow((M_m * D_m), 2.0))) / pow(d_m, 2.0))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m_m * d_m) / (2.0d0 * d_m_1)
if (t_0 <= 0.0001d0) then
tmp = w0 * sqrt((1.0d0 - (h * (((m_m * (d_m * (0.5d0 / d_m_1))) ** 2.0d0) / l))))
else if (t_0 <= 4d+153) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d_m_1 / m_m) * (2.0d0 / d_m)) ** (-2.0d0)))))
else
tmp = w0 * sqrt((1.0d0 - (((0.25d0 / l) * (h * ((m_m * d_m) ** 2.0d0))) / (d_m_1 ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * D_m) / (2.0 * d_m);
double tmp;
if (t_0 <= 0.0001) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
} else if (t_0 <= 4e+153) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((d_m / M_m) * (2.0 / D_m)), -2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - (((0.25 / l) * (h * Math.pow((M_m * D_m), 2.0))) / Math.pow(d_m, 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): t_0 = (M_m * D_m) / (2.0 * d_m) tmp = 0 if t_0 <= 0.0001: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l)))) elif t_0 <= 4e+153: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((d_m / M_m) * (2.0 / D_m)), -2.0)))) else: tmp = w0 * math.sqrt((1.0 - (((0.25 / l) * (h * math.pow((M_m * D_m), 2.0))) / math.pow(d_m, 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) tmp = 0.0 if (t_0 <= 0.0001) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) ^ 2.0) / l))))); elseif (t_0 <= 4e+153) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(d_m / M_m) * Float64(2.0 / D_m)) ^ -2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(0.25 / l) * Float64(h * (Float64(M_m * D_m) ^ 2.0))) / (d_m ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
t_0 = (M_m * D_m) / (2.0 * d_m);
tmp = 0.0;
if (t_0 <= 0.0001)
tmp = w0 * sqrt((1.0 - (h * (((M_m * (D_m * (0.5 / d_m))) ^ 2.0) / l))));
elseif (t_0 <= 4e+153)
tmp = w0 * sqrt((1.0 - ((h / l) * (((d_m / M_m) * (2.0 / D_m)) ^ -2.0))));
else
tmp = w0 * sqrt((1.0 - (((0.25 / l) * (h * ((M_m * D_m) ^ 2.0))) / (d_m ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0001], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+153], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(d$95$m / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(0.25 / l), $MachinePrecision] * N[(h * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[d$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := \frac{M_m \cdot D_m}{2 \cdot d_m}\\
\mathbf{if}\;t_0 \leq 0.0001:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 4 \cdot 10^{+153}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{d_m}{M_m} \cdot \frac{2}{D_m}\right)}^{-2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{0.25}{\ell} \cdot \left(h \cdot {\left(M_m \cdot D_m\right)}^{2}\right)}{{d_m}^{2}}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 2 d)) < 1.00000000000000005e-4Initial program 82.9%
Simplified82.0%
associate-*r/88.9%
clear-num88.9%
associate-*l/89.9%
div-inv89.9%
associate-*l*89.9%
associate-/r*89.9%
metadata-eval89.9%
Applied egg-rr89.9%
clear-num89.9%
*-commutative89.9%
associate-*l*88.9%
associate-*r/82.0%
expm1-log1p-u81.7%
expm1-udef81.7%
Applied egg-rr82.6%
expm1-def82.6%
expm1-log1p82.9%
associate-*r/89.9%
associate-*l/90.4%
*-commutative90.4%
associate-*l*90.3%
Simplified90.3%
if 1.00000000000000005e-4 < (/.f64 (*.f64 M D) (*.f64 2 d)) < 4e153Initial program 85.3%
Simplified74.7%
associate-*l/85.3%
clear-num85.4%
*-un-lft-identity85.4%
times-frac85.4%
metadata-eval85.4%
Applied egg-rr85.4%
associate-*r/78.4%
inv-pow78.4%
pow-pow78.5%
associate-*r/78.5%
metadata-eval78.5%
Applied egg-rr78.5%
associate-*r/85.4%
*-commutative85.4%
*-commutative85.4%
times-frac80.2%
Simplified80.2%
if 4e153 < (/.f64 (*.f64 M D) (*.f64 2 d)) Initial program 36.8%
Simplified36.8%
Taylor expanded in M around 0 40.4%
associate-*r/40.4%
*-commutative40.4%
times-frac40.8%
*-commutative40.8%
*-commutative40.8%
associate-*l*40.8%
unpow240.8%
unpow240.8%
swap-sqr49.9%
unpow249.9%
*-commutative49.9%
Simplified49.9%
associate-*r/54.2%
*-commutative54.2%
Applied egg-rr54.2%
Final simplification86.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<=
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)))))
5e+295)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* D_m (* M_m (/ 0.5 d_m))) 2.0)))))
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (* D_m (/ 0.5 d_m))) 2.0) l)))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((w0 * sqrt((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0))))) <= 5e+295) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D_m * (M_m * (0.5 / d_m))), 2.0))));
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if ((w0 * sqrt((1.0d0 - ((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0))))) <= 5d+295) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d_m * (m_m * (0.5d0 / d_m_1))) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 - (h * (((m_m * (d_m * (0.5d0 / d_m_1))) ** 2.0d0) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))))) <= 5e+295) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D_m * (M_m * (0.5 / d_m))), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))))) <= 5e+295: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D_m * (M_m * (0.5 / d_m))), 2.0)))) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0))))) <= 5e+295) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D_m * Float64(M_m * Float64(0.5 / d_m))) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) ^ 2.0) / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if ((w0 * sqrt((1.0 - ((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0))))) <= 5e+295)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D_m * (M_m * (0.5 / d_m))) ^ 2.0))));
else
tmp = w0 * sqrt((1.0 - (h * (((M_m * (D_m * (0.5 / d_m))) ^ 2.0) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e+295], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M_m \cdot D_m}{2 \cdot d_m}\right)}^{2}} \leq 5 \cdot 10^{+295}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < 4.99999999999999991e295Initial program 92.8%
associate-*l/89.9%
div-inv89.9%
associate-/r*89.9%
metadata-eval89.9%
Applied egg-rr89.9%
if 4.99999999999999991e295 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) Initial program 28.5%
Simplified30.3%
associate-*r/56.8%
clear-num56.8%
associate-*l/55.2%
div-inv55.2%
associate-*l*55.1%
associate-/r*55.1%
metadata-eval55.1%
Applied egg-rr55.1%
clear-num55.1%
*-commutative55.1%
associate-*l*56.8%
associate-*r/30.3%
expm1-log1p-u30.3%
expm1-udef30.3%
Applied egg-rr28.5%
expm1-def28.5%
expm1-log1p28.5%
associate-*r/55.2%
associate-*l/55.2%
*-commutative55.2%
associate-*l*55.1%
Simplified55.1%
Final simplification82.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0))) 1e+258)
(*
w0
(sqrt (- 1.0 (* (/ h l) (pow (/ 1.0 (* 2.0 (/ d_m (* M_m D_m)))) 2.0)))))
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (* D_m (/ 0.5 d_m))) 2.0) l)))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 1e+258) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((1.0 / (2.0 * (d_m / (M_m * D_m)))), 2.0))));
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if ((1.0d0 - ((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0))) <= 1d+258) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((1.0d0 / (2.0d0 * (d_m_1 / (m_m * d_m)))) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 - (h * (((m_m * (d_m * (0.5d0 / d_m_1))) ** 2.0d0) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((1.0 - ((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 1e+258) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((1.0 / (2.0 * (d_m / (M_m * D_m)))), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (1.0 - ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 1e+258: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((1.0 / (2.0 * (d_m / (M_m * D_m)))), 2.0)))) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0))) <= 1e+258) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(1.0 / Float64(2.0 * Float64(d_m / Float64(M_m * D_m)))) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) ^ 2.0) / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if ((1.0 - ((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0))) <= 1e+258)
tmp = w0 * sqrt((1.0 - ((h / l) * ((1.0 / (2.0 * (d_m / (M_m * D_m)))) ^ 2.0))));
else
tmp = w0 * sqrt((1.0 - (h * (((M_m * (D_m * (0.5 / d_m))) ^ 2.0) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+258], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(1.0 / N[(2.0 * N[(d$95$m / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - \frac{h}{\ell} \cdot {\left(\frac{M_m \cdot D_m}{2 \cdot d_m}\right)}^{2} \leq 10^{+258}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{1}{2 \cdot \frac{d_m}{M_m \cdot D_m}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 1.00000000000000006e258Initial program 99.9%
Simplified96.5%
associate-*l/99.9%
clear-num99.9%
*-un-lft-identity99.9%
times-frac99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if 1.00000000000000006e258 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 37.7%
Simplified38.8%
associate-*r/56.9%
clear-num57.0%
associate-*l/57.0%
div-inv57.0%
associate-*l*56.9%
associate-/r*56.9%
metadata-eval56.9%
Applied egg-rr56.9%
clear-num56.9%
*-commutative56.9%
associate-*l*56.9%
associate-*r/38.8%
expm1-log1p-u38.5%
expm1-udef38.5%
Applied egg-rr37.4%
expm1-def37.4%
expm1-log1p37.7%
associate-*r/57.0%
associate-*l/57.0%
*-commutative57.0%
associate-*l*57.0%
Simplified57.0%
Final simplification85.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= d_m 1.45e-124) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ d_m M_m) (/ 2.0 D_m)) -2.0))))) (* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (* D_m (/ 0.5 d_m))) 2.0) l)))))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (d_m <= 1.45e-124) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((d_m / M_m) * (2.0 / D_m)), -2.0))));
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if (d_m_1 <= 1.45d-124) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d_m_1 / m_m) * (2.0d0 / d_m)) ** (-2.0d0)))))
else
tmp = w0 * sqrt((1.0d0 - (h * (((m_m * (d_m * (0.5d0 / d_m_1))) ** 2.0d0) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (d_m <= 1.45e-124) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((d_m / M_m) * (2.0 / D_m)), -2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if d_m <= 1.45e-124: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((d_m / M_m) * (2.0 / D_m)), -2.0)))) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (d_m <= 1.45e-124) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(d_m / M_m) * Float64(2.0 / D_m)) ^ -2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) ^ 2.0) / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if (d_m <= 1.45e-124)
tmp = w0 * sqrt((1.0 - ((h / l) * (((d_m / M_m) * (2.0 / D_m)) ^ -2.0))));
else
tmp = w0 * sqrt((1.0 - (h * (((M_m * (D_m * (0.5 / d_m))) ^ 2.0) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[d$95$m, 1.45e-124], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(d$95$m / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d_m \leq 1.45 \cdot 10^{-124}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{d_m}{M_m} \cdot \frac{2}{D_m}\right)}^{-2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if d < 1.4500000000000001e-124Initial program 76.1%
Simplified73.5%
associate-*l/76.1%
clear-num76.1%
*-un-lft-identity76.1%
times-frac76.1%
metadata-eval76.1%
Applied egg-rr76.1%
associate-*r/77.2%
inv-pow77.2%
pow-pow77.2%
associate-*r/77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-*r/76.0%
*-commutative76.0%
*-commutative76.0%
times-frac75.2%
Simplified75.2%
if 1.4500000000000001e-124 < d Initial program 83.1%
Simplified82.2%
associate-*r/92.7%
clear-num92.7%
associate-*l/94.5%
div-inv94.5%
associate-*l*93.6%
associate-/r*93.6%
metadata-eval93.6%
Applied egg-rr93.6%
clear-num93.6%
*-commutative93.6%
associate-*l*92.7%
associate-*r/82.2%
expm1-log1p-u81.8%
expm1-udef81.8%
Applied egg-rr82.7%
expm1-def82.7%
expm1-log1p83.1%
associate-*r/94.5%
associate-*l/94.5%
*-commutative94.5%
associate-*l*93.6%
Simplified93.6%
Final simplification82.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (pow (* M_m (* D_m (/ 0.5 d_m))) 2.0) l))))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h * (((m_m * (d_m * (0.5d0 / d_m_1))) ** 2.0d0) / l))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (Math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (math.pow((M_m * (D_m * (0.5 / d_m))), 2.0) / l))))
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M_m * Float64(D_m * Float64(0.5 / d_m))) ^ 2.0) / l))))) end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp = code(w0, M_m, D_m, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * (((M_m * (D_m * (0.5 / d_m))) ^ 2.0) / l))));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d_m}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 79.0%
Simplified77.1%
associate-*r/82.9%
clear-num82.9%
associate-*l/84.4%
div-inv84.4%
associate-*l*84.4%
associate-/r*84.4%
metadata-eval84.4%
Applied egg-rr84.4%
clear-num84.3%
*-commutative84.3%
associate-*l*82.9%
associate-*r/77.1%
expm1-log1p-u76.7%
expm1-udef76.7%
Applied egg-rr78.5%
expm1-def78.5%
expm1-log1p79.0%
associate-*r/84.4%
associate-*l/85.1%
*-commutative85.1%
associate-*l*85.1%
Simplified85.1%
Final simplification85.1%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (* w0 (fma -0.125 (/ h (* l (pow (* M_m (/ D_m d_m)) -2.0))) 1.0)))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * fma(-0.125, (h / (l * pow((M_m * (D_m / d_m)), -2.0))), 1.0);
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * fma(-0.125, Float64(h / Float64(l * (Float64(M_m * Float64(D_m / d_m)) ^ -2.0))), 1.0)) end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[(-0.125 * N[(h / N[(l * N[Power[N[(M$95$m * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0 \cdot \mathsf{fma}\left(-0.125, \frac{h}{\ell \cdot {\left(M_m \cdot \frac{D_m}{d_m}\right)}^{-2}}, 1\right)
\end{array}
Initial program 79.0%
Simplified77.1%
associate-*r/82.9%
clear-num82.9%
associate-*l/84.4%
div-inv84.4%
associate-*l*84.4%
associate-/r*84.4%
metadata-eval84.4%
Applied egg-rr84.4%
Taylor expanded in l around inf 55.3%
+-commutative55.3%
fma-def55.3%
Simplified77.7%
div-inv77.7%
associate-*l/77.3%
*-commutative77.3%
pow-flip77.4%
*-commutative77.4%
associate-*l/77.7%
*-commutative77.7%
metadata-eval77.7%
Applied egg-rr77.7%
Final simplification77.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (* w0 (fma -0.125 (/ h (/ l (pow (/ M_m (/ d_m D_m)) 2.0))) 1.0)))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * fma(-0.125, (h / (l / pow((M_m / (d_m / D_m)), 2.0))), 1.0);
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * fma(-0.125, Float64(h / Float64(l / (Float64(M_m / Float64(d_m / D_m)) ^ 2.0))), 1.0)) end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[(-0.125 * N[(h / N[(l / N[Power[N[(M$95$m / N[(d$95$m / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0 \cdot \mathsf{fma}\left(-0.125, \frac{h}{\frac{\ell}{{\left(\frac{M_m}{\frac{d_m}{D_m}}\right)}^{2}}}, 1\right)
\end{array}
Initial program 79.0%
Simplified77.1%
associate-*r/82.9%
clear-num82.9%
associate-*l/84.4%
div-inv84.4%
associate-*l*84.4%
associate-/r*84.4%
metadata-eval84.4%
Applied egg-rr84.4%
Taylor expanded in l around inf 55.3%
+-commutative55.3%
fma-def55.3%
Simplified77.7%
associate-*l/77.3%
*-commutative77.3%
associate-/l*77.7%
Applied egg-rr77.7%
Final simplification77.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (* w0 (fma -0.125 (/ h (/ l (pow (/ (* M_m D_m) d_m) 2.0))) 1.0)))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * fma(-0.125, (h / (l / pow(((M_m * D_m) / d_m), 2.0))), 1.0);
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * fma(-0.125, Float64(h / Float64(l / (Float64(Float64(M_m * D_m) / d_m) ^ 2.0))), 1.0)) end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[(-0.125 * N[(h / N[(l / N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0 \cdot \mathsf{fma}\left(-0.125, \frac{h}{\frac{\ell}{{\left(\frac{M_m \cdot D_m}{d_m}\right)}^{2}}}, 1\right)
\end{array}
Initial program 79.0%
Simplified77.1%
associate-*r/82.9%
clear-num82.9%
associate-*l/84.4%
div-inv84.4%
associate-*l*84.4%
associate-/r*84.4%
metadata-eval84.4%
Applied egg-rr84.4%
Taylor expanded in l around inf 55.3%
+-commutative55.3%
fma-def55.3%
Simplified77.7%
associate-*l/77.3%
*-commutative77.3%
Applied egg-rr77.3%
Final simplification77.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (* M_m D_m) 2e-42)
w0
(fma
-0.125
(* (/ (* w0 h) l) (* (/ (* M_m D_m) d_m) (* D_m (/ M_m d_m))))
w0)))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((M_m * D_m) <= 2e-42) {
tmp = w0;
} else {
tmp = fma(-0.125, (((w0 * h) / l) * (((M_m * D_m) / d_m) * (D_m * (M_m / d_m)))), w0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(M_m * D_m) <= 2e-42) tmp = w0; else tmp = fma(-0.125, Float64(Float64(Float64(w0 * h) / l) * Float64(Float64(Float64(M_m * D_m) / d_m) * Float64(D_m * Float64(M_m / d_m)))), w0); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e-42], w0, N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \cdot D_m \leq 2 \cdot 10^{-42}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \frac{w0 \cdot h}{\ell} \cdot \left(\frac{M_m \cdot D_m}{d_m} \cdot \left(D_m \cdot \frac{M_m}{d_m}\right)\right), w0\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 2.00000000000000008e-42Initial program 81.5%
Simplified79.6%
Taylor expanded in M around 0 74.9%
if 2.00000000000000008e-42 < (*.f64 M D) Initial program 70.0%
Simplified68.2%
Taylor expanded in M around 0 39.2%
+-commutative39.2%
fma-def39.2%
associate-*r*39.2%
times-frac40.9%
*-commutative40.9%
unpow240.9%
unpow240.9%
swap-sqr52.4%
unpow252.4%
*-commutative52.4%
Simplified52.4%
add-sqr-sqrt52.4%
sqrt-div52.4%
unpow252.4%
sqrt-prod52.4%
add-sqr-sqrt52.4%
*-commutative52.4%
unpow252.4%
sqrt-prod29.7%
add-sqr-sqrt35.3%
sqrt-div35.3%
unpow235.3%
sqrt-prod39.0%
add-sqr-sqrt39.0%
*-commutative39.0%
unpow239.0%
sqrt-prod33.6%
add-sqr-sqrt56.5%
Applied egg-rr56.5%
Taylor expanded in M around 0 56.5%
associate-/l*56.4%
Simplified56.4%
associate-/r/56.5%
associate-*l/56.5%
*-commutative56.5%
associate-/l*56.5%
associate-/r/56.3%
Applied egg-rr56.3%
Final simplification70.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (/ (* M_m D_m) d_m)))
(if (<= (* M_m D_m) 2e-42)
w0
(fma -0.125 (* (* t_0 t_0) (/ (* w0 h) l)) w0))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * D_m) / d_m;
double tmp;
if ((M_m * D_m) <= 2e-42) {
tmp = w0;
} else {
tmp = fma(-0.125, ((t_0 * t_0) * ((w0 * h) / l)), w0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(M_m * D_m) / d_m) tmp = 0.0 if (Float64(M_m * D_m) <= 2e-42) tmp = w0; else tmp = fma(-0.125, Float64(Float64(t_0 * t_0) * Float64(Float64(w0 * h) / l)), w0); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e-42], w0, N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := \frac{M_m \cdot D_m}{d_m}\\
\mathbf{if}\;M_m \cdot D_m \leq 2 \cdot 10^{-42}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \left(t_0 \cdot t_0\right) \cdot \frac{w0 \cdot h}{\ell}, w0\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 2.00000000000000008e-42Initial program 81.5%
Simplified79.6%
Taylor expanded in M around 0 74.9%
if 2.00000000000000008e-42 < (*.f64 M D) Initial program 70.0%
Simplified68.2%
Taylor expanded in M around 0 39.2%
+-commutative39.2%
fma-def39.2%
associate-*r*39.2%
times-frac40.9%
*-commutative40.9%
unpow240.9%
unpow240.9%
swap-sqr52.4%
unpow252.4%
*-commutative52.4%
Simplified52.4%
add-sqr-sqrt52.4%
sqrt-div52.4%
unpow252.4%
sqrt-prod52.4%
add-sqr-sqrt52.4%
*-commutative52.4%
unpow252.4%
sqrt-prod29.7%
add-sqr-sqrt35.3%
sqrt-div35.3%
unpow235.3%
sqrt-prod39.0%
add-sqr-sqrt39.0%
*-commutative39.0%
unpow239.0%
sqrt-prod33.6%
add-sqr-sqrt56.5%
Applied egg-rr56.5%
Final simplification70.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (let* ((t_0 (/ D_m (/ d_m M_m)))) (if (<= M_m 6.2e-171) w0 (fma -0.125 (* (/ (* w0 h) l) (* t_0 t_0)) w0))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = D_m / (d_m / M_m);
double tmp;
if (M_m <= 6.2e-171) {
tmp = w0;
} else {
tmp = fma(-0.125, (((w0 * h) / l) * (t_0 * t_0)), w0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(D_m / Float64(d_m / M_m)) tmp = 0.0 if (M_m <= 6.2e-171) tmp = w0; else tmp = fma(-0.125, Float64(Float64(Float64(w0 * h) / l) * Float64(t_0 * t_0)), w0); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(D$95$m / N[(d$95$m / M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.2e-171], w0, N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := \frac{D_m}{\frac{d_m}{M_m}}\\
\mathbf{if}\;M_m \leq 6.2 \cdot 10^{-171}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \frac{w0 \cdot h}{\ell} \cdot \left(t_0 \cdot t_0\right), w0\right)\\
\end{array}
\end{array}
if M < 6.2000000000000001e-171Initial program 79.0%
Simplified77.2%
Taylor expanded in M around 0 71.0%
if 6.2000000000000001e-171 < M Initial program 79.1%
Simplified76.9%
Taylor expanded in M around 0 50.2%
+-commutative50.2%
fma-def50.2%
associate-*r*50.2%
times-frac54.4%
*-commutative54.4%
unpow254.4%
unpow254.4%
swap-sqr63.7%
unpow263.7%
*-commutative63.7%
Simplified63.7%
add-sqr-sqrt63.7%
sqrt-div63.7%
unpow263.7%
sqrt-prod38.6%
add-sqr-sqrt56.7%
*-commutative56.7%
unpow256.7%
sqrt-prod30.5%
add-sqr-sqrt49.9%
sqrt-div49.9%
unpow249.9%
sqrt-prod30.6%
add-sqr-sqrt54.6%
*-commutative54.6%
unpow254.6%
sqrt-prod39.8%
add-sqr-sqrt69.6%
Applied egg-rr69.6%
Taylor expanded in M around 0 69.6%
associate-/l*69.6%
Simplified69.6%
Taylor expanded in M around 0 69.6%
associate-/l*69.6%
Simplified69.6%
Final simplification70.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): return w0
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return w0 end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp = code(w0, M_m, D_m, h, l, d_m)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0
\end{array}
Initial program 79.0%
Simplified77.1%
Taylor expanded in M around 0 65.2%
Final simplification65.2%
herbie shell --seed 2023339
(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))))))