
(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 5 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 (let* ((t_0 (* D_m (* 0.5 (/ M_m d))))) (* w0 (pow (- 1.0 (* (* h t_0) (/ t_0 l))) 0.5))))
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 * (0.5 * (M_m / d));
return w0 * pow((1.0 - ((h * t_0) * (t_0 / l))), 0.5);
}
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
t_0 = d_m * (0.5d0 * (m_m / d))
code = w0 * ((1.0d0 - ((h * t_0) * (t_0 / l))) ** 0.5d0)
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 * (0.5 * (M_m / d));
return w0 * Math.pow((1.0 - ((h * t_0) * (t_0 / l))), 0.5);
}
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 * (0.5 * (M_m / d)) return w0 * math.pow((1.0 - ((h * t_0) * (t_0 / l))), 0.5)
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(0.5 * Float64(M_m / d))) return Float64(w0 * (Float64(1.0 - Float64(Float64(h * t_0) * Float64(t_0 / l))) ^ 0.5)) 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)
t_0 = D_m * (0.5 * (M_m / d));
tmp = w0 * ((1.0 - ((h * t_0) * (t_0 / l))) ^ 0.5);
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[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Power[N[(1.0 - N[(N[(h * t$95$0), $MachinePrecision] * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $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 := D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\\
w0 \cdot {\left(1 - \left(h \cdot t\_0\right) \cdot \frac{t\_0}{\ell}\right)}^{0.5}
\end{array}
\end{array}
Initial program 79.9%
Simplified81.0%
Applied egg-rr79.9%
*-lft-identity79.9%
associate-*l/84.7%
associate-/l*85.4%
associate-/l*85.8%
Simplified85.8%
unpow285.8%
*-un-lft-identity85.8%
times-frac88.0%
*-un-lft-identity88.0%
times-frac88.0%
metadata-eval88.0%
*-un-lft-identity88.0%
times-frac88.0%
metadata-eval88.0%
Applied egg-rr88.0%
associate-/l*85.0%
associate-*r/85.0%
Applied egg-rr85.0%
pow1/285.0%
/-rgt-identity85.0%
associate-*r*86.5%
associate-*r/89.2%
associate-*r/89.2%
Applied egg-rr89.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 (<= M_m 2.25e+43)
w0
(+
w0
(*
-0.125
(* (* (* D_m M_m) (* D_m M_m)) (/ (* w0 (/ h l)) (pow 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 (M_m <= 2.25e+43) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * (h / l)) / pow(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 (m_m <= 2.25d+43) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d_m * m_m) * (d_m * m_m)) * ((w0 * (h / l)) / (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 (M_m <= 2.25e+43) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * (h / l)) / Math.pow(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 M_m <= 2.25e+43: tmp = w0 else: tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * (h / l)) / math.pow(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 (M_m <= 2.25e+43) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D_m * M_m) * Float64(D_m * M_m)) * Float64(Float64(w0 * Float64(h / l)) / (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 (M_m <= 2.25e+43)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * (h / l)) / (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[M$95$m, 2.25e+43], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * N[(h / l), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $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.25 \cdot 10^{+43}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \frac{w0 \cdot \frac{h}{\ell}}{{d}^{2}}\right)\\
\end{array}
\end{array}
if M < 2.25e43Initial program 82.4%
Simplified83.3%
Taylor expanded in D around 0 78.0%
if 2.25e43 < M Initial program 70.3%
Simplified72.1%
Taylor expanded in D around 0 32.2%
associate-/l*33.8%
associate-/l*39.6%
Simplified39.6%
pow139.6%
associate-*r*39.5%
pow-prod-down47.6%
*-commutative47.6%
times-frac55.4%
Applied egg-rr55.4%
unpow155.4%
associate-*r/53.5%
Simplified53.5%
unpow253.5%
Applied egg-rr53.5%
Final simplification73.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 (<= M_m 7200000.0)
w0
(+
w0
(*
-0.125
(* (* (* D_m M_m) (* D_m M_m)) (/ (* w0 h) (* l (pow 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 (M_m <= 7200000.0) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * h) / (l * pow(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 (m_m <= 7200000.0d0) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d_m * m_m) * (d_m * m_m)) * ((w0 * h) / (l * (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 (M_m <= 7200000.0) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * h) / (l * Math.pow(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 M_m <= 7200000.0: tmp = w0 else: tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * h) / (l * math.pow(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 (M_m <= 7200000.0) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D_m * M_m) * Float64(D_m * M_m)) * Float64(Float64(w0 * h) / Float64(l * (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 (M_m <= 7200000.0)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D_m * M_m) * (D_m * M_m)) * ((w0 * h) / (l * (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[M$95$m, 7200000.0], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / N[(l * N[Power[d, 2.0], $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 7200000:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \frac{w0 \cdot h}{\ell \cdot {d}^{2}}\right)\\
\end{array}
\end{array}
if M < 7.2e6Initial program 82.5%
Simplified83.5%
Taylor expanded in D around 0 77.4%
if 7.2e6 < M Initial program 71.9%
Simplified73.4%
Taylor expanded in D around 0 38.3%
associate-/l*39.7%
associate-/l*44.6%
Simplified44.6%
pow144.6%
associate-*r*44.5%
pow-prod-down51.2%
*-commutative51.2%
times-frac57.8%
Applied egg-rr57.8%
unpow157.8%
associate-*r/56.2%
Simplified56.2%
unpow256.2%
Applied egg-rr56.2%
Taylor expanded in h around 0 51.2%
Final simplification71.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 (let* ((t_0 (* 0.5 (/ M_m d)))) (* w0 (sqrt (- 1.0 (* (* h (* D_m t_0)) (* D_m (/ t_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 t_0 = 0.5 * (M_m / d);
return w0 * sqrt((1.0 - ((h * (D_m * t_0)) * (D_m * (t_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
real(8) :: t_0
t_0 = 0.5d0 * (m_m / d)
code = w0 * sqrt((1.0d0 - ((h * (d_m * t_0)) * (d_m * (t_0 / 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) {
double t_0 = 0.5 * (M_m / d);
return w0 * Math.sqrt((1.0 - ((h * (D_m * t_0)) * (D_m * (t_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): t_0 = 0.5 * (M_m / d) return w0 * math.sqrt((1.0 - ((h * (D_m * t_0)) * (D_m * (t_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) t_0 = Float64(0.5 * Float64(M_m / d)) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(D_m * t_0)) * Float64(D_m * Float64(t_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)
t_0 = 0.5 * (M_m / d);
tmp = w0 * sqrt((1.0 - ((h * (D_m * t_0)) * (D_m * (t_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_] := Block[{t$95$0 = N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(D$95$m * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(t$95$0 / 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}
t_0 := 0.5 \cdot \frac{M\_m}{d}\\
w0 \cdot \sqrt{1 - \left(h \cdot \left(D\_m \cdot t\_0\right)\right) \cdot \left(D\_m \cdot \frac{t\_0}{\ell}\right)}
\end{array}
\end{array}
Initial program 79.9%
Simplified81.0%
Applied egg-rr79.9%
*-lft-identity79.9%
associate-*l/84.7%
associate-/l*85.4%
associate-/l*85.8%
Simplified85.8%
unpow285.8%
*-un-lft-identity85.8%
times-frac88.0%
*-un-lft-identity88.0%
times-frac88.0%
metadata-eval88.0%
*-un-lft-identity88.0%
times-frac88.0%
metadata-eval88.0%
Applied egg-rr88.0%
associate-/l*85.0%
associate-*r/85.0%
Applied egg-rr85.0%
*-un-lft-identity85.0%
/-rgt-identity85.0%
associate-*r*86.4%
associate-*r/89.1%
associate-*r/89.1%
Applied egg-rr89.1%
*-lft-identity89.1%
*-commutative89.1%
associate-*r/86.4%
Simplified86.4%
Final simplification86.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 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 79.9%
Simplified81.0%
Taylor expanded in D around 0 70.6%
herbie shell --seed 2024092
(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))))))