
(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 (<= (* (pow (/ (* D_m M_m) (* d 2.0)) 2.0) (/ h l)) 1e-7) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* D_m (/ M_m (* d 2.0))) 2.0))))) 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 ((pow(((D_m * M_m) / (d * 2.0)), 2.0) * (h / l)) <= 1e-7) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D_m * (M_m / (d * 2.0))), 2.0))));
} 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 (((((d_m * m_m) / (d * 2.0d0)) ** 2.0d0) * (h / l)) <= 1d-7) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d_m * (m_m / (d * 2.0d0))) ** 2.0d0))))
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 ((Math.pow(((D_m * M_m) / (d * 2.0)), 2.0) * (h / l)) <= 1e-7) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D_m * (M_m / (d * 2.0))), 2.0))));
} 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 (math.pow(((D_m * M_m) / (d * 2.0)), 2.0) * (h / l)) <= 1e-7: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D_m * (M_m / (d * 2.0))), 2.0)))) 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((Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= 1e-7) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))))); 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 (((((D_m * M_m) / (d * 2.0)) ^ 2.0) * (h / l)) <= 1e-7)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D_m * (M_m / (d * 2.0))) ^ 2.0))));
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[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 1e-7], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;{\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 10^{-7}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 9.9999999999999995e-8Initial program 87.1%
Simplified88.0%
if 9.9999999999999995e-8 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 0.0%
Simplified0.0%
Taylor expanded in M around 0 70.5%
Final simplification86.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 (<= (/ h l) -5e-314) (fma -0.125 (* w0 (/ (* h (pow (* M_m (/ D_m d)) 2.0)) l)) w0) 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) <= -5e-314) {
tmp = fma(-0.125, (w0 * ((h * pow((M_m * (D_m / d)), 2.0)) / l)), w0);
} 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) <= -5e-314) tmp = fma(-0.125, Float64(w0 * Float64(Float64(h * (Float64(M_m * Float64(D_m / d)) ^ 2.0)) / l)), w0); else tmp = w0; end return 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-314], N[(-0.125 * N[(w0 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + w0), $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 -5 \cdot 10^{-314}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, w0 \cdot \frac{h \cdot {\left(M_m \cdot \frac{D_m}{d}\right)}^{2}}{\ell}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.99999999982e-314Initial program 76.7%
Simplified78.1%
Taylor expanded in M around 0 42.7%
+-commutative42.7%
fma-def42.7%
associate-*r*44.1%
times-frac45.5%
*-commutative45.5%
unpow245.5%
unpow245.5%
swap-sqr54.7%
unpow254.7%
*-commutative54.7%
Simplified54.7%
Taylor expanded in D around 0 42.7%
associate-*r*44.1%
unpow244.1%
unpow244.1%
swap-sqr54.8%
unpow254.8%
times-frac54.7%
unpow254.7%
unpow254.7%
times-frac62.1%
unpow262.1%
associate-*l/64.2%
associate-*r*68.4%
Simplified68.5%
associate-*l/72.0%
associate-/r/71.3%
Applied egg-rr71.3%
if -4.99999999982e-314 < (/.f64 h l) Initial program 81.1%
Simplified81.1%
Taylor expanded in M around 0 92.7%
Final simplification80.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 (* w0 (sqrt (+ 1.0 (* (* h (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) (/ -1.0 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) {
return w0 * sqrt((1.0 + ((h * pow((D_m * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l))));
}
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 * sqrt((1.0d0 + ((h * ((d_m * (m_m * (0.5d0 / d))) ** 2.0d0)) * ((-1.0d0) / l))))
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 * Math.sqrt((1.0 + ((h * Math.pow((D_m * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l))));
}
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 * math.sqrt((1.0 + ((h * math.pow((D_m * (M_m * (0.5 / d))), 2.0)) * (-1.0 / l))))
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 Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(h * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)) * Float64(-1.0 / l))))) 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 * sqrt((1.0 + ((h * ((D_m * (M_m * (0.5 / d))) ^ 2.0)) * (-1.0 / l))));
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_] := N[(w0 * N[Sqrt[N[(1.0 + N[(N[(h * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $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])\\
\\
w0 \cdot \sqrt{1 + \left(h \cdot {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right) \cdot \frac{-1}{\ell}}
\end{array}
Initial program 78.6%
Simplified79.4%
associate-*r/85.1%
clear-num85.1%
associate-*l/84.7%
div-inv84.7%
associate-*l*84.6%
associate-/r*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
associate-/r/84.7%
*-commutative84.7%
*-commutative84.7%
associate-*r*85.1%
*-commutative85.1%
Simplified85.1%
Final simplification85.1%
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-314) (fma -0.125 (* w0 (* (/ h l) (/ (* (* M_m (/ D_m d)) (* D_m M_m)) d))) w0) 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) <= -5e-314) {
tmp = fma(-0.125, (w0 * ((h / l) * (((M_m * (D_m / d)) * (D_m * M_m)) / d))), w0);
} 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) <= -5e-314) tmp = fma(-0.125, Float64(w0 * Float64(Float64(h / l) * Float64(Float64(Float64(M_m * Float64(D_m / d)) * Float64(D_m * M_m)) / d))), w0); else tmp = w0; end return 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-314], N[(-0.125 * N[(w0 * N[(N[(h / l), $MachinePrecision] * N[(N[(N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $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 -5 \cdot 10^{-314}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, w0 \cdot \left(\frac{h}{\ell} \cdot \frac{\left(M_m \cdot \frac{D_m}{d}\right) \cdot \left(D_m \cdot M_m\right)}{d}\right), w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.99999999982e-314Initial program 76.7%
Simplified78.1%
Taylor expanded in M around 0 42.7%
+-commutative42.7%
fma-def42.7%
associate-*r*44.1%
times-frac45.5%
*-commutative45.5%
unpow245.5%
unpow245.5%
swap-sqr54.7%
unpow254.7%
*-commutative54.7%
Simplified54.7%
Taylor expanded in D around 0 42.7%
associate-*r*44.1%
unpow244.1%
unpow244.1%
swap-sqr54.8%
unpow254.8%
times-frac54.7%
unpow254.7%
unpow254.7%
times-frac62.1%
unpow262.1%
associate-*l/64.2%
associate-*r*68.4%
Simplified68.5%
associate-/l*68.4%
pow268.4%
associate-*r/68.4%
associate-/l*68.4%
associate-/r/67.7%
Applied egg-rr67.7%
if -4.99999999982e-314 < (/.f64 h l) Initial program 81.1%
Simplified81.1%
Taylor expanded in M around 0 92.7%
Final simplification78.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
(let* ((t_0 (/ D_m (/ d M_m))))
(if (<= M_m 3.3e-201)
w0
(fma -0.125 (* (/ t_0 l) (/ t_0 (/ 1.0 (* w0 h)))) 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 t_0 = D_m / (d / M_m);
double tmp;
if (M_m <= 3.3e-201) {
tmp = w0;
} else {
tmp = fma(-0.125, ((t_0 / l) * (t_0 / (1.0 / (w0 * h)))), 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) t_0 = Float64(D_m / Float64(d / M_m)) tmp = 0.0 if (M_m <= 3.3e-201) tmp = w0; else tmp = fma(-0.125, Float64(Float64(t_0 / l) * Float64(t_0 / Float64(1.0 / Float64(w0 * h)))), w0); end return 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_] := Block[{t$95$0 = N[(D$95$m / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 3.3e-201], w0, N[(-0.125 * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / N[(1.0 / N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $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}
t_0 := \frac{D_m}{\frac{d}{M_m}}\\
\mathbf{if}\;M_m \leq 3.3 \cdot 10^{-201}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \frac{t_0}{\ell} \cdot \frac{t_0}{\frac{1}{w0 \cdot h}}, w0\right)\\
\end{array}
\end{array}
if M < 3.3000000000000003e-201Initial program 78.7%
Simplified79.9%
Taylor expanded in M around 0 69.3%
if 3.3000000000000003e-201 < M Initial program 78.5%
Simplified78.5%
Taylor expanded in M around 0 49.2%
+-commutative49.2%
fma-def49.2%
associate-*r*51.1%
times-frac52.1%
*-commutative52.1%
unpow252.1%
unpow252.1%
swap-sqr61.8%
unpow261.8%
*-commutative61.8%
Simplified61.8%
associate-*r/63.7%
add-sqr-sqrt63.7%
pow263.7%
sqrt-div63.7%
unpow263.7%
sqrt-prod43.6%
add-sqr-sqrt70.4%
unpow270.4%
sqrt-prod37.5%
add-sqr-sqrt74.3%
Applied egg-rr74.3%
associate-/l*72.4%
associate-/l*72.4%
Simplified72.4%
associate-/r/72.4%
unpow272.4%
div-inv72.4%
times-frac78.0%
associate-/r/77.1%
associate-/r/77.1%
Applied egg-rr77.1%
Final simplification72.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 (let* ((t_0 (/ D_m (/ d M_m)))) (if (<= M_m 8e-185) w0 (fma -0.125 (* t_0 (/ t_0 (/ l (* w0 h)))) 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 t_0 = D_m / (d / M_m);
double tmp;
if (M_m <= 8e-185) {
tmp = w0;
} else {
tmp = fma(-0.125, (t_0 * (t_0 / (l / (w0 * h)))), 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) t_0 = Float64(D_m / Float64(d / M_m)) tmp = 0.0 if (M_m <= 8e-185) tmp = w0; else tmp = fma(-0.125, Float64(t_0 * Float64(t_0 / Float64(l / Float64(w0 * h)))), w0); end return 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_] := Block[{t$95$0 = N[(D$95$m / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 8e-185], w0, N[(-0.125 * N[(t$95$0 * N[(t$95$0 / N[(l / N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $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}
t_0 := \frac{D_m}{\frac{d}{M_m}}\\
\mathbf{if}\;M_m \leq 8 \cdot 10^{-185}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, t_0 \cdot \frac{t_0}{\frac{\ell}{w0 \cdot h}}, w0\right)\\
\end{array}
\end{array}
if M < 7.9999999999999999e-185Initial program 78.1%
Simplified79.3%
Taylor expanded in M around 0 69.0%
if 7.9999999999999999e-185 < M Initial program 79.4%
Simplified79.4%
Taylor expanded in M around 0 49.6%
+-commutative49.6%
fma-def49.6%
associate-*r*51.7%
times-frac52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
swap-sqr61.8%
unpow261.8%
*-commutative61.8%
Simplified61.8%
associate-*r/63.9%
add-sqr-sqrt63.9%
pow263.9%
sqrt-div63.9%
unpow263.9%
sqrt-prod43.8%
add-sqr-sqrt70.9%
unpow270.9%
sqrt-prod38.3%
add-sqr-sqrt74.9%
Applied egg-rr74.9%
associate-/l*72.9%
associate-/l*72.9%
Simplified72.9%
associate-/r/72.9%
unpow272.9%
*-un-lft-identity72.9%
times-frac76.9%
associate-/r/76.0%
associate-/r/76.0%
Applied egg-rr76.0%
Final simplification71.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 (<= M_m 3e+29) w0 (* -0.125 (/ (* h (- (pow (* M_m (/ D_m d)) 2.0))) (/ (- l) 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 (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * ((h * -pow((M_m * (D_m / d)), 2.0)) / (-l / 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 (m_m <= 3d+29) then
tmp = w0
else
tmp = (-0.125d0) * ((h * -((m_m * (d_m / d)) ** 2.0d0)) / (-l / 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 (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * ((h * -Math.pow((M_m * (D_m / d)), 2.0)) / (-l / 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 M_m <= 3e+29: tmp = w0 else: tmp = -0.125 * ((h * -math.pow((M_m * (D_m / d)), 2.0)) / (-l / 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 (M_m <= 3e+29) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(h * Float64(-(Float64(M_m * Float64(D_m / d)) ^ 2.0))) / Float64(Float64(-l) / 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 (M_m <= 3e+29)
tmp = w0;
else
tmp = -0.125 * ((h * -((M_m * (D_m / d)) ^ 2.0)) / (-l / 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[M$95$m, 3e+29], w0, N[(-0.125 * N[(N[(h * (-N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision] / N[((-l) / w0), $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 3 \cdot 10^{+29}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{h \cdot \left(-{\left(M_m \cdot \frac{D_m}{d}\right)}^{2}\right)}{\frac{-\ell}{w0}}\\
\end{array}
\end{array}
if M < 2.9999999999999999e29Initial program 80.4%
Simplified81.3%
Taylor expanded in M around 0 72.6%
if 2.9999999999999999e29 < M Initial program 71.6%
Simplified71.7%
associate-*r/78.1%
clear-num78.1%
associate-*l/78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in l around inf 43.4%
associate-*r*43.5%
unpow243.5%
unpow243.5%
swap-sqr60.9%
unpow260.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in h around inf 20.8%
associate-*r*20.7%
times-frac22.6%
unpow222.6%
unpow222.6%
swap-sqr25.3%
unpow225.3%
times-frac25.8%
associate-*l/25.8%
associate-*l/25.8%
unpow225.8%
*-commutative25.8%
associate-*l/23.8%
*-commutative23.8%
Simplified23.8%
*-commutative23.8%
unpow223.8%
associate-*l/23.8%
associate-*l/23.8%
frac-times23.2%
unpow223.2%
unpow223.2%
*-commutative23.2%
associate-/r/25.4%
frac-2neg25.4%
frac-times25.3%
Applied egg-rr25.3%
times-frac25.4%
associate-*r/25.6%
unpow225.6%
associate-*r/25.9%
associate-/l*25.9%
unpow225.9%
associate-*r/26.0%
associate-*r/25.9%
times-frac26.0%
associate-/l*26.0%
unpow226.0%
associate-/r/26.0%
distribute-neg-frac26.0%
Simplified26.0%
Final simplification63.1%
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 3e+29) w0 (* -0.125 (* (pow (* M_m (/ D_m d)) 2.0) (/ h (/ l 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 (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * (pow((M_m * (D_m / d)), 2.0) * (h / (l / 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 (m_m <= 3d+29) then
tmp = w0
else
tmp = (-0.125d0) * (((m_m * (d_m / d)) ** 2.0d0) * (h / (l / 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 (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * (Math.pow((M_m * (D_m / d)), 2.0) * (h / (l / 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 M_m <= 3e+29: tmp = w0 else: tmp = -0.125 * (math.pow((M_m * (D_m / d)), 2.0) * (h / (l / 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 (M_m <= 3e+29) tmp = w0; else tmp = Float64(-0.125 * Float64((Float64(M_m * Float64(D_m / d)) ^ 2.0) * Float64(h / Float64(l / 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 (M_m <= 3e+29)
tmp = w0;
else
tmp = -0.125 * (((M_m * (D_m / d)) ^ 2.0) * (h / (l / 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[M$95$m, 3e+29], w0, N[(-0.125 * N[(N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / N[(l / w0), $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 3 \cdot 10^{+29}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left({\left(M_m \cdot \frac{D_m}{d}\right)}^{2} \cdot \frac{h}{\frac{\ell}{w0}}\right)\\
\end{array}
\end{array}
if M < 2.9999999999999999e29Initial program 80.4%
Simplified81.3%
Taylor expanded in M around 0 72.6%
if 2.9999999999999999e29 < M Initial program 71.6%
Simplified71.7%
associate-*r/78.1%
clear-num78.1%
associate-*l/78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in l around inf 43.4%
associate-*r*43.5%
unpow243.5%
unpow243.5%
swap-sqr60.9%
unpow260.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in h around inf 20.8%
associate-*r*20.7%
times-frac22.6%
unpow222.6%
unpow222.6%
swap-sqr25.3%
unpow225.3%
times-frac25.8%
associate-*l/25.8%
associate-*l/25.8%
unpow225.8%
*-commutative25.8%
associate-*l/23.8%
*-commutative23.8%
Simplified23.8%
Taylor expanded in w0 around 0 25.8%
associate-/l*26.0%
Simplified26.0%
Final simplification63.1%
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 2e+31) w0 (* -0.125 (/ (* (* w0 h) (pow (/ D_m (/ d M_m)) 2.0)) 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 <= 2e+31) {
tmp = w0;
} else {
tmp = -0.125 * (((w0 * h) * pow((D_m / (d / M_m)), 2.0)) / 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 <= 2d+31) then
tmp = w0
else
tmp = (-0.125d0) * (((w0 * h) * ((d_m / (d / m_m)) ** 2.0d0)) / 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 <= 2e+31) {
tmp = w0;
} else {
tmp = -0.125 * (((w0 * h) * Math.pow((D_m / (d / M_m)), 2.0)) / 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 <= 2e+31: tmp = w0 else: tmp = -0.125 * (((w0 * h) * math.pow((D_m / (d / M_m)), 2.0)) / 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 <= 2e+31) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(w0 * h) * (Float64(D_m / Float64(d / M_m)) ^ 2.0)) / 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 <= 2e+31)
tmp = w0;
else
tmp = -0.125 * (((w0 * h) * ((D_m / (d / M_m)) ^ 2.0)) / 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, 2e+31], w0, N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] * N[Power[N[(D$95$m / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $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 2 \cdot 10^{+31}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{\left(w0 \cdot h\right) \cdot {\left(\frac{D_m}{\frac{d}{M_m}}\right)}^{2}}{\ell}\\
\end{array}
\end{array}
if M < 1.9999999999999999e31Initial program 80.4%
Simplified81.3%
Taylor expanded in M around 0 72.6%
if 1.9999999999999999e31 < M Initial program 71.6%
Simplified71.7%
associate-*r/78.1%
clear-num78.1%
associate-*l/78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in l around inf 43.4%
associate-*r*43.5%
unpow243.5%
unpow243.5%
swap-sqr60.9%
unpow260.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in h around inf 20.8%
associate-*r*20.7%
times-frac22.6%
unpow222.6%
unpow222.6%
swap-sqr25.3%
unpow225.3%
times-frac25.8%
associate-*l/25.8%
associate-*l/25.8%
unpow225.8%
*-commutative25.8%
associate-*l/23.8%
*-commutative23.8%
Simplified23.8%
*-commutative23.8%
metadata-eval23.8%
metadata-eval23.8%
pow-pow20.5%
pow1/323.8%
pow-pow23.8%
associate-*r/25.8%
*-commutative25.8%
associate-*r/25.9%
pow-pow25.9%
pow1/322.6%
pow-pow25.9%
associate-/r/25.9%
metadata-eval25.9%
metadata-eval25.9%
Applied egg-rr25.9%
Final simplification63.1%
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 (let* ((t_0 (/ D_m (/ d M_m)))) (if (<= M_m 3e+29) w0 (* -0.125 (* (* t_0 t_0) (* w0 (/ h 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 t_0 = D_m / (d / M_m);
double tmp;
if (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * ((t_0 * t_0) * (w0 * (h / 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) :: t_0
real(8) :: tmp
t_0 = d_m / (d / m_m)
if (m_m <= 3d+29) then
tmp = w0
else
tmp = (-0.125d0) * ((t_0 * t_0) * (w0 * (h / 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 t_0 = D_m / (d / M_m);
double tmp;
if (M_m <= 3e+29) {
tmp = w0;
} else {
tmp = -0.125 * ((t_0 * t_0) * (w0 * (h / 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): t_0 = D_m / (d / M_m) tmp = 0 if M_m <= 3e+29: tmp = w0 else: tmp = -0.125 * ((t_0 * t_0) * (w0 * (h / 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) t_0 = Float64(D_m / Float64(d / M_m)) tmp = 0.0 if (M_m <= 3e+29) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(t_0 * t_0) * Float64(w0 * Float64(h / 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)
t_0 = D_m / (d / M_m);
tmp = 0.0;
if (M_m <= 3e+29)
tmp = w0;
else
tmp = -0.125 * ((t_0 * t_0) * (w0 * (h / 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_] := Block[{t$95$0 = N[(D$95$m / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 3e+29], w0, N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(w0 * N[(h / 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}
t_0 := \frac{D_m}{\frac{d}{M_m}}\\
\mathbf{if}\;M_m \leq 3 \cdot 10^{+29}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(t_0 \cdot t_0\right) \cdot \left(w0 \cdot \frac{h}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 2.9999999999999999e29Initial program 80.4%
Simplified81.3%
Taylor expanded in M around 0 72.6%
if 2.9999999999999999e29 < M Initial program 71.6%
Simplified71.7%
associate-*r/78.1%
clear-num78.1%
associate-*l/78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/78.1%
*-commutative78.1%
*-commutative78.1%
associate-*r*78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in l around inf 43.4%
associate-*r*43.5%
unpow243.5%
unpow243.5%
swap-sqr60.9%
unpow260.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in h around inf 20.8%
associate-*r*20.7%
times-frac22.6%
unpow222.6%
unpow222.6%
swap-sqr25.3%
unpow225.3%
times-frac25.8%
associate-*l/25.8%
associate-*l/25.8%
unpow225.8%
*-commutative25.8%
associate-*l/23.8%
*-commutative23.8%
Simplified23.8%
*-commutative23.8%
associate-/r/23.8%
unpow223.8%
Applied egg-rr23.8%
Final simplification62.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 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 78.6%
Simplified79.4%
Taylor expanded in M around 0 69.5%
Final simplification69.5%
herbie shell --seed 2023334
(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))))))