
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
M_m = (fabs.f64 M)
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-90)
(*
w0
(sqrt
(-
1.0
(/ (/ (* (* 0.5 (* (/ (* M_m D_m) d) (* D_m (* M_m 0.5)))) h) l) d))))
(*
w0
(sqrt
(-
1.0
(* (* M_m (/ (/ D_m d) 2.0)) (* h (/ (* 0.5 (* D_m (/ M_m d))) 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-90) {
tmp = w0 * sqrt((1.0 - ((((0.5 * (((M_m * D_m) / d) * (D_m * (M_m * 0.5)))) * h) / l) / d)));
} else {
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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-90) then
tmp = w0 * sqrt((1.0d0 - ((((0.5d0 * (((m_m * d_m) / d) * (d_m * (m_m * 0.5d0)))) * h) / l) / d)))
else
tmp = w0 * sqrt((1.0d0 - ((m_m * ((d_m / d) / 2.0d0)) * (h * ((0.5d0 * (d_m * (m_m / d))) / 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-90) {
tmp = w0 * Math.sqrt((1.0 - ((((0.5 * (((M_m * D_m) / d) * (D_m * (M_m * 0.5)))) * h) / l) / d)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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-90: tmp = w0 * math.sqrt((1.0 - ((((0.5 * (((M_m * D_m) / d) * (D_m * (M_m * 0.5)))) * h) / l) / d))) else: tmp = w0 * math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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-90) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.5 * Float64(Float64(Float64(M_m * D_m) / d) * Float64(D_m * Float64(M_m * 0.5)))) * h) / l) / d)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m / d) / 2.0)) * Float64(h * Float64(Float64(0.5 * Float64(D_m * Float64(M_m / d))) / 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-90)
tmp = w0 * sqrt((1.0 - ((((0.5 * (((M_m * D_m) / d) * (D_m * (M_m * 0.5)))) * h) / l) / d)));
else
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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-90], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.5 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 2 \cdot 10^{-90}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\left(0.5 \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot \left(D\_m \cdot \left(M\_m \cdot 0.5\right)\right)\right)\right) \cdot h}{\ell}}{d}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{\frac{D\_m}{d}}{2}\right) \cdot \left(h \cdot \frac{0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)}{\ell}\right)}\\
\end{array}
\end{array}
if M < 1.99999999999999999e-90Initial program 84.8%
Simplified84.2%
unpow284.2%
associate-/r*84.2%
associate-*r/84.3%
*-commutative84.3%
associate-/r*84.3%
associate-*r/83.7%
clear-num83.7%
un-div-inv83.7%
associate-/r/83.7%
div-inv83.7%
*-commutative83.7%
metadata-eval83.7%
associate-*r*83.7%
Applied egg-rr83.7%
associate-*l/84.2%
Applied egg-rr84.2%
Taylor expanded in D around 0 85.3%
associate-*r/89.7%
associate-*l*89.7%
Applied egg-rr89.7%
if 1.99999999999999999e-90 < M Initial program 73.8%
Simplified73.8%
unpow273.8%
associate-/r*73.8%
associate-*r/73.8%
*-commutative73.8%
associate-/r*73.8%
associate-*r/71.1%
clear-num71.1%
un-div-inv71.1%
associate-/r/71.1%
div-inv71.1%
*-commutative71.1%
metadata-eval71.1%
associate-*r*71.1%
Applied egg-rr71.1%
associate-*r/75.8%
associate-/l*77.2%
Applied egg-rr77.2%
pow177.2%
associate-*l*78.2%
associate-*r*78.2%
Applied egg-rr78.2%
unpow178.2%
associate-*l/78.2%
associate-/l*78.2%
*-commutative78.2%
*-commutative78.2%
associate-*r/78.2%
associate-/l*79.6%
Simplified79.6%
*-un-lft-identity79.6%
associate-/l*80.9%
associate-/r*80.9%
associate-*r/80.9%
Applied egg-rr80.9%
*-lft-identity80.9%
associate-/r/80.9%
associate-/l*81.0%
associate-*r/82.3%
Simplified82.3%
Final simplification87.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 (<= d 1.45e-55)
(*
w0
(sqrt
(-
1.0
(/ (* (* (* D_m (* M_m 0.5)) (/ D_m (* 2.0 (/ d M_m)))) (/ h l)) d))))
(*
w0
(sqrt
(-
1.0
(* (* M_m (/ (/ D_m d) 2.0)) (* h (/ (* 0.5 (* D_m (/ M_m d))) 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 (d <= 1.45e-55) {
tmp = w0 * sqrt((1.0 - ((((D_m * (M_m * 0.5)) * (D_m / (2.0 * (d / M_m)))) * (h / l)) / d)));
} else {
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 (d <= 1.45d-55) then
tmp = w0 * sqrt((1.0d0 - ((((d_m * (m_m * 0.5d0)) * (d_m / (2.0d0 * (d / m_m)))) * (h / l)) / d)))
else
tmp = w0 * sqrt((1.0d0 - ((m_m * ((d_m / d) / 2.0d0)) * (h * ((0.5d0 * (d_m * (m_m / d))) / 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 (d <= 1.45e-55) {
tmp = w0 * Math.sqrt((1.0 - ((((D_m * (M_m * 0.5)) * (D_m / (2.0 * (d / M_m)))) * (h / l)) / d)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 d <= 1.45e-55: tmp = w0 * math.sqrt((1.0 - ((((D_m * (M_m * 0.5)) * (D_m / (2.0 * (d / M_m)))) * (h / l)) / d))) else: tmp = w0 * math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 (d <= 1.45e-55) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(D_m * Float64(M_m * 0.5)) * Float64(D_m / Float64(2.0 * Float64(d / M_m)))) * Float64(h / l)) / d)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m / d) / 2.0)) * Float64(h * Float64(Float64(0.5 * Float64(D_m * Float64(M_m / d))) / 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 (d <= 1.45e-55)
tmp = w0 * sqrt((1.0 - ((((D_m * (M_m * 0.5)) * (D_m / (2.0 * (d / M_m)))) * (h / l)) / d)));
else
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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[d, 1.45e-55], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / N[(2.0 * N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.45 \cdot 10^{-55}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\left(D\_m \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \frac{D\_m}{2 \cdot \frac{d}{M\_m}}\right) \cdot \frac{h}{\ell}}{d}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{\frac{D\_m}{d}}{2}\right) \cdot \left(h \cdot \frac{0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)}{\ell}\right)}\\
\end{array}
\end{array}
if d < 1.45e-55Initial program 79.4%
Simplified78.8%
unpow278.8%
associate-/r*78.8%
associate-*r/78.8%
*-commutative78.8%
associate-/r*78.8%
associate-*r/78.8%
clear-num78.8%
un-div-inv78.8%
associate-/r/78.8%
div-inv78.8%
*-commutative78.8%
metadata-eval78.8%
associate-*r*78.8%
Applied egg-rr78.8%
associate-*l/78.8%
Applied egg-rr78.8%
if 1.45e-55 < d Initial program 86.5%
Simplified86.5%
unpow286.5%
associate-/r*86.5%
associate-*r/86.5%
*-commutative86.5%
associate-/r*86.5%
associate-*r/83.2%
clear-num83.2%
un-div-inv83.2%
associate-/r/83.2%
div-inv83.2%
*-commutative83.2%
metadata-eval83.2%
associate-*r*83.2%
Applied egg-rr83.2%
associate-*r/90.1%
associate-/l*92.3%
Applied egg-rr92.3%
pow192.3%
associate-*l*93.4%
associate-*r*93.4%
Applied egg-rr93.4%
unpow193.4%
associate-*l/93.4%
associate-/l*93.4%
*-commutative93.4%
*-commutative93.4%
associate-*r/93.4%
associate-/l*94.5%
Simplified94.5%
*-un-lft-identity94.5%
associate-/l*95.6%
associate-/r*95.6%
associate-*r/94.5%
Applied egg-rr94.5%
*-lft-identity94.5%
associate-/r/94.5%
associate-/l*93.4%
associate-*r/94.5%
Simplified94.5%
Final simplification84.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 (<= d 2.1e-54)
(*
w0
(sqrt
(-
1.0
(/ (* (/ h l) (* (* D_m (* M_m 0.5)) (* 0.5 (/ (* M_m D_m) d)))) d))))
(*
w0
(sqrt
(-
1.0
(* (* M_m (/ (/ D_m d) 2.0)) (* h (/ (* 0.5 (* D_m (/ M_m d))) 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 (d <= 2.1e-54) {
tmp = w0 * sqrt((1.0 - (((h / l) * ((D_m * (M_m * 0.5)) * (0.5 * ((M_m * D_m) / d)))) / d)));
} else {
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 (d <= 2.1d-54) then
tmp = w0 * sqrt((1.0d0 - (((h / l) * ((d_m * (m_m * 0.5d0)) * (0.5d0 * ((m_m * d_m) / d)))) / d)))
else
tmp = w0 * sqrt((1.0d0 - ((m_m * ((d_m / d) / 2.0d0)) * (h * ((0.5d0 * (d_m * (m_m / d))) / 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 (d <= 2.1e-54) {
tmp = w0 * Math.sqrt((1.0 - (((h / l) * ((D_m * (M_m * 0.5)) * (0.5 * ((M_m * D_m) / d)))) / d)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 d <= 2.1e-54: tmp = w0 * math.sqrt((1.0 - (((h / l) * ((D_m * (M_m * 0.5)) * (0.5 * ((M_m * D_m) / d)))) / d))) else: tmp = w0 * math.sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 (d <= 2.1e-54) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(Float64(D_m * Float64(M_m * 0.5)) * Float64(0.5 * Float64(Float64(M_m * D_m) / d)))) / d)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m / d) / 2.0)) * Float64(h * Float64(Float64(0.5 * Float64(D_m * Float64(M_m / d))) / 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 (d <= 2.1e-54)
tmp = w0 * sqrt((1.0 - (((h / l) * ((D_m * (M_m * 0.5)) * (0.5 * ((M_m * D_m) / d)))) / d)));
else
tmp = w0 * sqrt((1.0 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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[d, 2.1e-54], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(N[(D$95$m * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.1 \cdot 10^{-54}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{h}{\ell} \cdot \left(\left(D\_m \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \left(0.5 \cdot \frac{M\_m \cdot D\_m}{d}\right)\right)}{d}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{\frac{D\_m}{d}}{2}\right) \cdot \left(h \cdot \frac{0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)}{\ell}\right)}\\
\end{array}
\end{array}
if d < 2.1e-54Initial program 79.4%
Simplified78.8%
unpow278.8%
associate-/r*78.8%
associate-*r/78.8%
*-commutative78.8%
associate-/r*78.8%
associate-*r/78.8%
clear-num78.8%
un-div-inv78.8%
associate-/r/78.8%
div-inv78.8%
*-commutative78.8%
metadata-eval78.8%
associate-*r*78.8%
Applied egg-rr78.8%
associate-*l/78.8%
Applied egg-rr78.8%
Taylor expanded in D around 0 80.5%
if 2.1e-54 < d Initial program 86.5%
Simplified86.5%
unpow286.5%
associate-/r*86.5%
associate-*r/86.5%
*-commutative86.5%
associate-/r*86.5%
associate-*r/83.2%
clear-num83.2%
un-div-inv83.2%
associate-/r/83.2%
div-inv83.2%
*-commutative83.2%
metadata-eval83.2%
associate-*r*83.2%
Applied egg-rr83.2%
associate-*r/90.1%
associate-/l*92.3%
Applied egg-rr92.3%
pow192.3%
associate-*l*93.4%
associate-*r*93.4%
Applied egg-rr93.4%
unpow193.4%
associate-*l/93.4%
associate-/l*93.4%
*-commutative93.4%
*-commutative93.4%
associate-*r/93.4%
associate-/l*94.5%
Simplified94.5%
*-un-lft-identity94.5%
associate-/l*95.6%
associate-/r*95.6%
associate-*r/94.5%
Applied egg-rr94.5%
*-lft-identity94.5%
associate-/r/94.5%
associate-/l*93.4%
associate-*r/94.5%
Simplified94.5%
Final simplification85.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (/ h l) -2e-292)
(*
w0
(sqrt
(- 1.0 (* (/ h l) (* D_m (* 0.25 (/ (* D_m (/ M_m d)) (/ d M_m))))))))
w0))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-292) {
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if ((h / l) <= (-2d-292)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (d_m * (0.25d0 * ((d_m * (m_m / d)) / (d / m_m)))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-292) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -2e-292: tmp = w0 * math.sqrt((1.0 - ((h / l) * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m))))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -2e-292) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(D_m * Float64(0.25 * Float64(Float64(D_m * Float64(M_m / d)) / Float64(d / M_m)))))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -2e-292)
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m)))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -2e-292], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(D$95$m * N[(0.25 * N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-292}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(D\_m \cdot \left(0.25 \cdot \frac{D\_m \cdot \frac{M\_m}{d}}{\frac{d}{M\_m}}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -2.0000000000000001e-292Initial program 78.2%
Simplified78.2%
unpow278.2%
associate-/r*78.2%
associate-*r/78.2%
*-commutative78.2%
associate-/r*78.2%
associate-*r/77.1%
clear-num77.0%
un-div-inv77.1%
associate-/r/77.1%
div-inv77.1%
*-commutative77.1%
metadata-eval77.1%
associate-*r*77.1%
Applied egg-rr77.1%
associate-*r/80.5%
associate-/l*81.1%
Applied egg-rr81.1%
*-un-lft-identity81.1%
associate-/l*78.2%
associate-*r*78.2%
Applied egg-rr78.2%
Simplified78.2%
if -2.0000000000000001e-292 < (/.f64 h l) Initial program 87.6%
Simplified86.6%
Taylor expanded in D around 0 96.1%
Final simplification85.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (/ h l) -2e-292)
(*
w0
(sqrt
(- 1.0 (* (/ h l) (* D_m (* 0.25 (* D_m (/ M_m (* d (/ d M_m))))))))))
w0))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-292) {
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (0.25 * (D_m * (M_m / (d * (d / M_m)))))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if ((h / l) <= (-2d-292)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (d_m * (0.25d0 * (d_m * (m_m / (d * (d / m_m)))))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-292) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (D_m * (0.25 * (D_m * (M_m / (d * (d / M_m)))))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -2e-292: tmp = w0 * math.sqrt((1.0 - ((h / l) * (D_m * (0.25 * (D_m * (M_m / (d * (d / M_m))))))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -2e-292) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(D_m * Float64(0.25 * Float64(D_m * Float64(M_m / Float64(d * Float64(d / M_m)))))))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -2e-292)
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (0.25 * (D_m * (M_m / (d * (d / M_m)))))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -2e-292], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(D$95$m * N[(0.25 * N[(D$95$m * N[(M$95$m / N[(d * N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-292}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(D\_m \cdot \left(0.25 \cdot \left(D\_m \cdot \frac{M\_m}{d \cdot \frac{d}{M\_m}}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -2.0000000000000001e-292Initial program 78.2%
Simplified78.2%
unpow278.2%
associate-/r*78.2%
associate-*r/78.2%
*-commutative78.2%
associate-/r*78.2%
associate-*r/77.1%
clear-num77.0%
un-div-inv77.1%
associate-/r/77.1%
div-inv77.1%
*-commutative77.1%
metadata-eval77.1%
associate-*r*77.1%
Applied egg-rr77.1%
associate-*r/80.5%
associate-/l*81.1%
Applied egg-rr81.1%
*-un-lft-identity81.1%
associate-/l*78.2%
associate-*r*78.2%
Applied egg-rr78.2%
Simplified78.2%
associate-*l/80.5%
*-commutative80.5%
associate-/l*78.1%
Applied egg-rr78.1%
associate-*l/75.8%
associate-/l/74.6%
Simplified74.6%
if -2.0000000000000001e-292 < (/.f64 h l) Initial program 87.6%
Simplified86.6%
Taylor expanded in D around 0 96.1%
Final simplification82.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
(sqrt
(-
1.0
(/ (* (/ D_m (* d (/ 2.0 M_m))) (* h (* 0.5 (* D_m (/ M_m d))))) 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 - (((D_m / (d * (2.0 / M_m))) * (h * (0.5 * (D_m * (M_m / d))))) / 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 - (((d_m / (d * (2.0d0 / m_m))) * (h * (0.5d0 * (d_m * (m_m / d))))) / 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 - (((D_m / (d * (2.0 / M_m))) * (h * (0.5 * (D_m * (M_m / d))))) / 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 - (((D_m / (d * (2.0 / M_m))) * (h * (0.5 * (D_m * (M_m / d))))) / 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(Float64(D_m / Float64(d * Float64(2.0 / M_m))) * Float64(h * Float64(0.5 * Float64(D_m * Float64(M_m / d))))) / 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 - (((D_m / (d * (2.0 / M_m))) * (h * (0.5 * (D_m * (M_m / d))))) / 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[(N[(D$95$m / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
w0 \cdot \sqrt{1 - \frac{\frac{D\_m}{d \cdot \frac{2}{M\_m}} \cdot \left(h \cdot \left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)\right)\right)}{\ell}}
\end{array}
Initial program 81.8%
Simplified81.4%
unpow281.4%
associate-/r*81.4%
associate-*r/81.4%
*-commutative81.4%
associate-/r*81.4%
associate-*r/80.3%
clear-num80.3%
un-div-inv80.3%
associate-/r/80.3%
div-inv80.3%
*-commutative80.3%
metadata-eval80.3%
associate-*r*80.3%
Applied egg-rr80.3%
associate-*r/85.2%
associate-/l*86.0%
Applied egg-rr86.0%
pow186.0%
associate-*l*87.4%
associate-*r*87.4%
Applied egg-rr87.4%
unpow187.4%
associate-*l/87.4%
associate-/l*87.4%
*-commutative87.4%
*-commutative87.4%
associate-*r/87.4%
associate-/l*87.8%
Simplified87.8%
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
(* (* M_m (/ (/ D_m d) 2.0)) (* h (/ (* 0.5 (* D_m (/ M_m d))) 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 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 - ((m_m * ((d_m / d) / 2.0d0)) * (h * ((0.5d0 * (d_m * (m_m / d))) / 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 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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(M_m * Float64(Float64(D_m / d) / 2.0)) * Float64(h * Float64(Float64(0.5 * Float64(D_m * Float64(M_m / d))) / 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 - ((M_m * ((D_m / d) / 2.0)) * (h * ((0.5 * (D_m * (M_m / d))) / 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[(M$95$m * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{\frac{D\_m}{d}}{2}\right) \cdot \left(h \cdot \frac{0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)}{\ell}\right)}
\end{array}
Initial program 81.8%
Simplified81.4%
unpow281.4%
associate-/r*81.4%
associate-*r/81.4%
*-commutative81.4%
associate-/r*81.4%
associate-*r/80.3%
clear-num80.3%
un-div-inv80.3%
associate-/r/80.3%
div-inv80.3%
*-commutative80.3%
metadata-eval80.3%
associate-*r*80.3%
Applied egg-rr80.3%
associate-*r/85.2%
associate-/l*86.0%
Applied egg-rr86.0%
pow186.0%
associate-*l*87.4%
associate-*r*87.4%
Applied egg-rr87.4%
unpow187.4%
associate-*l/87.4%
associate-/l*87.4%
*-commutative87.4%
*-commutative87.4%
associate-*r/87.4%
associate-/l*87.8%
Simplified87.8%
*-un-lft-identity87.8%
associate-/l*88.5%
associate-/r*87.0%
associate-*r/88.1%
Applied egg-rr88.1%
*-lft-identity88.1%
associate-/r/88.1%
associate-/l*88.1%
associate-*r/87.4%
Simplified87.4%
Final simplification87.4%
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 (<= D_m 2.05e+61) w0 (+ w0 (* -0.125 (* (* h (/ w0 l)) (pow (* D_m (/ M_m d)) 2.0))))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 2.05e+61) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * pow((D_m * (M_m / d)), 2.0)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (d_m <= 2.05d+61) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((h * (w0 / l)) * ((d_m * (m_m / d)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 2.05e+61) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * Math.pow((D_m * (M_m / d)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if D_m <= 2.05e+61: tmp = w0 else: tmp = w0 + (-0.125 * ((h * (w0 / l)) * math.pow((D_m * (M_m / d)), 2.0))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (D_m <= 2.05e+61) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 / l)) * (Float64(D_m * Float64(M_m / d)) ^ 2.0)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if (D_m <= 2.05e+61)
tmp = w0;
else
tmp = w0 + (-0.125 * ((h * (w0 / l)) * ((D_m * (M_m / d)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[D$95$m, 2.05e+61], w0, N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;D\_m \leq 2.05 \cdot 10^{+61}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot \frac{w0}{\ell}\right) \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\\
\end{array}
\end{array}
if D < 2.04999999999999986e61Initial program 81.9%
Simplified81.4%
Taylor expanded in D around 0 75.7%
if 2.04999999999999986e61 < D Initial program 81.2%
Simplified81.3%
Taylor expanded in D around 0 43.0%
+-commutative43.0%
fma-define43.0%
associate-*r*41.2%
unpow241.2%
unpow241.2%
swap-sqr59.3%
unpow259.3%
Simplified59.3%
fma-undefine59.3%
times-frac60.8%
Applied egg-rr60.8%
Taylor expanded in D around 0 43.0%
associate-*r*41.2%
unpow241.2%
unpow241.2%
swap-sqr59.3%
unpow259.3%
*-commutative59.3%
*-commutative59.3%
times-frac60.8%
associate-*r/62.5%
unpow262.5%
unpow262.5%
times-frac68.5%
unpow168.5%
pow-plus68.5%
associate-*r/68.5%
metadata-eval68.5%
Simplified68.5%
Final simplification74.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 (* w0 (sqrt (- 1.0 (/ (* h (* D_m (* 0.25 (/ (* D_m (/ M_m d)) (/ d M_m))))) 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 * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m))))) / 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 * (0.25d0 * ((d_m * (m_m / d)) / (d / m_m))))) / 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 * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m))))) / 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 * (D_m * (0.25 * ((D_m * (M_m / d)) / (d / M_m))))) / 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(0.25 * Float64(Float64(D_m * Float64(M_m / d)) / Float64(d / M_m))))) / 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 * (0.25 * ((D_m * (M_m / d)) / (d / M_m))))) / 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[(D$95$m * N[(0.25 * N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot \left(D\_m \cdot \left(0.25 \cdot \frac{D\_m \cdot \frac{M\_m}{d}}{\frac{d}{M\_m}}\right)\right)}{\ell}}
\end{array}
Initial program 81.8%
Simplified81.4%
unpow281.4%
associate-/r*81.4%
associate-*r/81.4%
*-commutative81.4%
associate-/r*81.4%
associate-*r/80.3%
clear-num80.3%
un-div-inv80.3%
associate-/r/80.3%
div-inv80.3%
*-commutative80.3%
metadata-eval80.3%
associate-*r*80.3%
Applied egg-rr80.3%
associate-*r/85.2%
associate-/l*86.0%
Applied egg-rr86.0%
pow186.0%
associate-*l*87.4%
associate-*r*87.4%
Applied egg-rr87.4%
unpow187.4%
associate-*l/87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l/87.8%
associate-*l*87.8%
associate-*l*86.0%
*-commutative86.0%
associate-*l/84.1%
associate-*l/86.0%
associate-*r*84.9%
Simplified84.9%
Final simplification84.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 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 81.8%
Simplified81.4%
Taylor expanded in D around 0 66.4%
herbie shell --seed 2024139
(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))))))