
(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 7 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)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<=
(* w0_m (sqrt (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)))))
2e+221)
(* w0_m (sqrt (- 1.0 (* (/ h l) (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
(*
w0_m
(sqrt
(-
1.0
(*
h
(* (* 0.5 (/ (* M_m D_m) d)) (/ (/ (* D_m (* M_m 0.5)) d) l)))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((w0_m * sqrt((1.0 - (pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))))) <= 2e+221) {
tmp = w0_m * sqrt((1.0 - ((h / l) * pow((D_m * ((M_m / 2.0) / d)), 2.0))));
} else {
tmp = w0_m * sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l)))));
}
return w0_s * tmp;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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 ((w0_m * sqrt((1.0d0 - ((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l))))) <= 2d+221) then
tmp = w0_m * sqrt((1.0d0 - ((h / l) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0))))
else
tmp = w0_m * sqrt((1.0d0 - (h * ((0.5d0 * ((m_m * d_m) / d)) * (((d_m * (m_m * 0.5d0)) / d) / l)))))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((w0_m * Math.sqrt((1.0 - (Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))))) <= 2e+221) {
tmp = w0_m * Math.sqrt((1.0 - ((h / l) * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0))));
} else {
tmp = w0_m * Math.sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l)))));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if (w0_m * math.sqrt((1.0 - (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))))) <= 2e+221: tmp = w0_m * math.sqrt((1.0 - ((h / l) * math.pow((D_m * ((M_m / 2.0) / d)), 2.0)))) else: tmp = w0_m * math.sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l))))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(w0_m * sqrt(Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) <= 2e+221) tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0))))); else tmp = Float64(w0_m * sqrt(Float64(1.0 - Float64(h * Float64(Float64(0.5 * Float64(Float64(M_m * D_m) / d)) * Float64(Float64(Float64(D_m * Float64(M_m * 0.5)) / d) / l)))))); end return Float64(w0_s * tmp) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = 0.0;
if ((w0_m * sqrt((1.0 - ((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l))))) <= 2e+221)
tmp = w0_m * sqrt((1.0 - ((h / l) * ((D_m * ((M_m / 2.0) / d)) ^ 2.0))));
else
tmp = w0_m * sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l)))));
end
tmp_2 = w0_s * tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e+221], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0$95$m * N[Sqrt[N[(1.0 - N[(h * N[(N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;w0\_m \cdot \sqrt{1 - {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \leq 2 \cdot 10^{+221}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\_m \cdot \sqrt{1 - h \cdot \left(\left(0.5 \cdot \frac{M\_m \cdot D\_m}{d}\right) \cdot \frac{\frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d}}{\ell}\right)}\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 2.0000000000000001e221Initial program 93.2%
Simplified91.2%
if 2.0000000000000001e221 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) Initial program 46.0%
Simplified47.5%
associate-*r/68.3%
clear-num68.3%
*-commutative68.3%
associate-/r*68.3%
Applied egg-rr68.3%
clear-num68.3%
associate-/l*70.9%
clear-num70.9%
*-commutative70.9%
associate-*r/70.9%
div-inv70.9%
*-un-lft-identity70.9%
*-commutative70.9%
times-frac70.9%
clear-num70.9%
div-inv70.9%
metadata-eval70.9%
Applied egg-rr70.9%
unpow270.9%
*-un-lft-identity70.9%
times-frac76.3%
associate-*r/72.3%
associate-*r/72.3%
Applied egg-rr72.3%
Taylor expanded in M around 0 72.3%
Final simplification85.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(*
w0_m
(sqrt
(-
1.0
(* h (* (* 0.5 (/ (* M_m D_m) d)) (/ (/ (* D_m (* M_m 0.5)) d) l))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * (w0_m * sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l))))));
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_s * (w0_m * sqrt((1.0d0 - (h * ((0.5d0 * ((m_m * d_m) / d)) * (((d_m * (m_m * 0.5d0)) / d) / l))))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * (w0_m * Math.sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l))))));
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): return w0_s * (w0_m * math.sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l))))))
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) return Float64(w0_s * Float64(w0_m * sqrt(Float64(1.0 - Float64(h * Float64(Float64(0.5 * Float64(Float64(M_m * D_m) / d)) * Float64(Float64(Float64(D_m * Float64(M_m * 0.5)) / d) / l))))))) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = w0_s * (w0_m * sqrt((1.0 - (h * ((0.5 * ((M_m * D_m) / d)) * (((D_m * (M_m * 0.5)) / d) / l))))));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * N[(w0$95$m * N[Sqrt[N[(1.0 - N[(h * N[(N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \left(w0\_m \cdot \sqrt{1 - h \cdot \left(\left(0.5 \cdot \frac{M\_m \cdot D\_m}{d}\right) \cdot \frac{\frac{D\_m \cdot \left(M\_m \cdot 0.5\right)}{d}}{\ell}\right)}\right)
\end{array}
Initial program 80.0%
Simplified78.9%
associate-*r/84.4%
clear-num84.4%
*-commutative84.4%
associate-/r*84.4%
Applied egg-rr84.4%
clear-num84.4%
associate-/l*84.3%
clear-num84.3%
*-commutative84.3%
associate-*r/84.3%
div-inv84.3%
*-un-lft-identity84.3%
*-commutative84.3%
times-frac84.0%
clear-num84.0%
div-inv84.0%
metadata-eval84.0%
Applied egg-rr84.0%
unpow284.0%
*-un-lft-identity84.0%
times-frac85.5%
associate-*r/84.4%
associate-*r/85.5%
Applied egg-rr85.5%
Taylor expanded in M around 0 85.5%
Final simplification85.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<= D_m 3.2e+93)
w0_m
(+ w0_m (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (* w0_m (/ h l))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 3.2e+93) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * (pow((D_m * (M_m / d)), 2.0) * (w0_m * (h / l))));
}
return w0_s * tmp;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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 <= 3.2d+93) then
tmp = w0_m
else
tmp = w0_m + ((-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (w0_m * (h / l))))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 3.2e+93) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (w0_m * (h / l))));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if D_m <= 3.2e+93: tmp = w0_m else: tmp = w0_m + (-0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (w0_m * (h / l)))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (D_m <= 3.2e+93) tmp = w0_m; else tmp = Float64(w0_m + Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(w0_m * Float64(h / l))))); end return Float64(w0_s * tmp) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = 0.0;
if (D_m <= 3.2e+93)
tmp = w0_m;
else
tmp = w0_m + (-0.125 * (((D_m * (M_m / d)) ^ 2.0) * (w0_m * (h / l))));
end
tmp_2 = w0_s * tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[D$95$m, 3.2e+93], w0$95$m, N[(w0$95$m + N[(-0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(w0$95$m * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;D\_m \leq 3.2 \cdot 10^{+93}:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m + -0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(w0\_m \cdot \frac{h}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 3.2000000000000001e93Initial program 79.5%
Simplified77.7%
Taylor expanded in D around 0 68.6%
if 3.2000000000000001e93 < D Initial program 82.7%
Simplified85.2%
Taylor expanded in D around 0 31.1%
associate-/l*31.0%
times-frac36.1%
*-commutative36.1%
Simplified36.1%
expm1-log1p-u36.1%
expm1-undefine33.5%
add-sqr-sqrt33.5%
pow233.5%
sqrt-div33.5%
sqrt-pow136.2%
metadata-eval36.2%
pow136.2%
sqrt-pow141.8%
metadata-eval41.8%
pow141.8%
Applied egg-rr41.8%
expm1-define44.4%
Simplified44.4%
pow-to-exp44.4%
*-commutative44.4%
expm1-log1p-u44.4%
pow244.4%
frac-times36.1%
unpow236.1%
unpow236.1%
pow136.1%
Applied egg-rr75.9%
unpow175.9%
Simplified75.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<= M_m 118000.0)
w0_m
(+
w0_m
(*
-0.125
(* (* D_m D_m) (/ (* (* M_m (/ M_m d)) (* w0_m h)) (* d l))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 118000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m * (M_m / d)) * (w0_m * h)) / (d * l))));
}
return w0_s * tmp;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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 <= 118000.0d0) then
tmp = w0_m
else
tmp = w0_m + ((-0.125d0) * ((d_m * d_m) * (((m_m * (m_m / d)) * (w0_m * h)) / (d * l))))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 118000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m * (M_m / d)) * (w0_m * h)) / (d * l))));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if M_m <= 118000.0: tmp = w0_m else: tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m * (M_m / d)) * (w0_m * h)) / (d * l)))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 118000.0) tmp = w0_m; else tmp = Float64(w0_m + Float64(-0.125 * Float64(Float64(D_m * D_m) * Float64(Float64(Float64(M_m * Float64(M_m / d)) * Float64(w0_m * h)) / Float64(d * l))))); end return Float64(w0_s * tmp) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = 0.0;
if (M_m <= 118000.0)
tmp = w0_m;
else
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m * (M_m / d)) * (w0_m * h)) / (d * l))));
end
tmp_2 = w0_s * tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[M$95$m, 118000.0], w0$95$m, N[(w0$95$m + N[(-0.125 * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(w0$95$m * h), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;M\_m \leq 118000:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m + -0.125 \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{\left(M\_m \cdot \frac{M\_m}{d}\right) \cdot \left(w0\_m \cdot h\right)}{d \cdot \ell}\right)\\
\end{array}
\end{array}
if M < 118000Initial program 81.3%
Simplified79.5%
Taylor expanded in D around 0 70.6%
if 118000 < M Initial program 74.9%
Simplified76.6%
Taylor expanded in D around 0 46.6%
associate-/l*46.6%
times-frac48.4%
*-commutative48.4%
Simplified48.4%
expm1-log1p-u48.4%
expm1-undefine46.5%
add-sqr-sqrt46.5%
pow246.5%
sqrt-div46.5%
sqrt-pow159.5%
metadata-eval59.5%
pow159.5%
sqrt-pow159.6%
metadata-eval59.6%
pow159.6%
Applied egg-rr59.6%
expm1-define61.5%
Simplified61.5%
expm1-log1p-u61.5%
pow261.5%
associate-*r/61.5%
frac-times59.6%
*-commutative59.6%
Applied egg-rr59.6%
unpow259.6%
Applied egg-rr59.6%
Final simplification68.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<= M_m 2050000.0)
w0_m
(+
w0_m
(*
-0.125
(* (* D_m D_m) (* (* (/ M_m d) (/ M_m d)) (/ (* w0_m h) l))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 2050000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m / d) * (M_m / d)) * ((w0_m * h) / l))));
}
return w0_s * tmp;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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 <= 2050000.0d0) then
tmp = w0_m
else
tmp = w0_m + ((-0.125d0) * ((d_m * d_m) * (((m_m / d) * (m_m / d)) * ((w0_m * h) / l))))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 2050000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m / d) * (M_m / d)) * ((w0_m * h) / l))));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if M_m <= 2050000.0: tmp = w0_m else: tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m / d) * (M_m / d)) * ((w0_m * h) / l)))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 2050000.0) tmp = w0_m; else tmp = Float64(w0_m + Float64(-0.125 * Float64(Float64(D_m * D_m) * Float64(Float64(Float64(M_m / d) * Float64(M_m / d)) * Float64(Float64(w0_m * h) / l))))); end return Float64(w0_s * tmp) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = 0.0;
if (M_m <= 2050000.0)
tmp = w0_m;
else
tmp = w0_m + (-0.125 * ((D_m * D_m) * (((M_m / d) * (M_m / d)) * ((w0_m * h) / l))));
end
tmp_2 = w0_s * tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[M$95$m, 2050000.0], w0$95$m, N[(w0$95$m + N[(-0.125 * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(N[(w0$95$m * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;M\_m \leq 2050000:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m + -0.125 \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \left(\left(\frac{M\_m}{d} \cdot \frac{M\_m}{d}\right) \cdot \frac{w0\_m \cdot h}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 2.05e6Initial program 81.4%
Simplified79.6%
Taylor expanded in D around 0 70.3%
if 2.05e6 < M Initial program 74.4%
Simplified76.2%
Taylor expanded in D around 0 47.5%
associate-/l*47.5%
times-frac49.3%
*-commutative49.3%
Simplified49.3%
unpow249.3%
unpow249.3%
times-frac62.6%
Applied egg-rr62.6%
unpow260.8%
Applied egg-rr62.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
w0\_m = (fabs.f64 w0)
w0\_s = (copysign.f64 #s(literal 1 binary64) w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0_s w0_m M_m D_m h l d)
:precision binary64
(*
w0_s
(if (<= M_m 2500000.0)
w0_m
(+
w0_m
(*
-0.125
(* (* D_m D_m) (* (* w0_m (/ h l)) (* (/ M_m d) (/ M_m d)))))))))M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 2500000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * ((w0_m * (h / l)) * ((M_m / d) * (M_m / d)))));
}
return w0_s * tmp;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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 <= 2500000.0d0) then
tmp = w0_m
else
tmp = w0_m + ((-0.125d0) * ((d_m * d_m) * ((w0_m * (h / l)) * ((m_m / d) * (m_m / d)))))
end if
code = w0_s * tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (M_m <= 2500000.0) {
tmp = w0_m;
} else {
tmp = w0_m + (-0.125 * ((D_m * D_m) * ((w0_m * (h / l)) * ((M_m / d) * (M_m / d)))));
}
return w0_s * tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): tmp = 0 if M_m <= 2500000.0: tmp = w0_m else: tmp = w0_m + (-0.125 * ((D_m * D_m) * ((w0_m * (h / l)) * ((M_m / d) * (M_m / d))))) return w0_s * tmp
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) tmp = 0.0 if (M_m <= 2500000.0) tmp = w0_m; else tmp = Float64(w0_m + Float64(-0.125 * Float64(Float64(D_m * D_m) * Float64(Float64(w0_m * Float64(h / l)) * Float64(Float64(M_m / d) * Float64(M_m / d)))))); end return Float64(w0_s * tmp) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = 0.0;
if (M_m <= 2500000.0)
tmp = w0_m;
else
tmp = w0_m + (-0.125 * ((D_m * D_m) * ((w0_m * (h / l)) * ((M_m / d) * (M_m / d)))));
end
tmp_2 = w0_s * tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * If[LessEqual[M$95$m, 2500000.0], w0$95$m, N[(w0$95$m + N[(-0.125 * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(w0$95$m * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot \begin{array}{l}
\mathbf{if}\;M\_m \leq 2500000:\\
\;\;\;\;w0\_m\\
\mathbf{else}:\\
\;\;\;\;w0\_m + -0.125 \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \left(\left(w0\_m \cdot \frac{h}{\ell}\right) \cdot \left(\frac{M\_m}{d} \cdot \frac{M\_m}{d}\right)\right)\right)\\
\end{array}
\end{array}
if M < 2.5e6Initial program 81.4%
Simplified79.6%
Taylor expanded in D around 0 70.3%
if 2.5e6 < M Initial program 74.4%
Simplified76.2%
Taylor expanded in D around 0 47.5%
associate-/l*47.5%
times-frac49.3%
*-commutative49.3%
Simplified49.3%
unpow249.3%
unpow249.3%
times-frac62.6%
Applied egg-rr62.6%
unpow260.8%
Applied egg-rr62.6%
Taylor expanded in w0 around 0 62.6%
*-commutative62.6%
associate-*r/62.6%
Simplified62.6%
Final simplification68.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) w0\_m = (fabs.f64 w0) w0\_s = (copysign.f64 #s(literal 1 binary64) w0) NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0_s w0_m M_m D_m h l d) :precision binary64 (* w0_s w0_m))
M_m = fabs(M);
D_m = fabs(D);
w0\_m = fabs(w0);
w0\_s = copysign(1.0, w0);
assert(w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * w0_m;
}
M_m = abs(m)
D_m = abs(d)
w0\_m = abs(w0)
w0\_s = copysign(1.0d0, w0)
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0_s, w0_m, m_m, d_m, h, l, d)
real(8), intent (in) :: w0_s
real(8), intent (in) :: w0_m
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_s * w0_m
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
w0\_m = Math.abs(w0);
w0\_s = Math.copySign(1.0, w0);
assert w0_m < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0_s, double w0_m, double M_m, double D_m, double h, double l, double d) {
return w0_s * w0_m;
}
M_m = math.fabs(M) D_m = math.fabs(D) w0\_m = math.fabs(w0) w0\_s = math.copysign(1.0, w0) [w0_m, M_m, D_m, h, l, d] = sort([w0_m, M_m, D_m, h, l, d]) def code(w0_s, w0_m, M_m, D_m, h, l, d): return w0_s * w0_m
M_m = abs(M) D_m = abs(D) w0\_m = abs(w0) w0\_s = copysign(1.0, w0) w0_m, M_m, D_m, h, l, d = sort([w0_m, M_m, D_m, h, l, d]) function code(w0_s, w0_m, M_m, D_m, h, l, d) return Float64(w0_s * w0_m) end
M_m = abs(M);
D_m = abs(D);
w0\_m = abs(w0);
w0\_s = sign(w0) * abs(1.0);
w0_m, M_m, D_m, h, l, d = num2cell(sort([w0_m, M_m, D_m, h, l, d])){:}
function tmp = code(w0_s, w0_m, M_m, D_m, h, l, d)
tmp = w0_s * w0_m;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
w0\_m = N[Abs[w0], $MachinePrecision]
w0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: w0_m, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0$95$s_, w0$95$m_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0$95$s * w0$95$m), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
w0\_m = \left|w0\right|
\\
w0\_s = \mathsf{copysign}\left(1, w0\right)
\\
[w0_m, M_m, D_m, h, l, d] = \mathsf{sort}([w0_m, M_m, D_m, h, l, d])\\
\\
w0\_s \cdot w0\_m
\end{array}
Initial program 80.0%
Simplified78.9%
Taylor expanded in D around 0 65.6%
herbie shell --seed 2024177
(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))))))