
(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 4 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -5e-8)
(* w0 (hypot 1.0 (* D_m (* 0.5 (* (/ M_m d) (sqrt (/ h (- l))))))))
(*
w0
(sqrt (- 1.0 (* (/ 1.0 l) (* h (pow (* D_m (* 0.5 (/ 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 ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -5e-8) {
tmp = w0 * hypot(1.0, (D_m * (0.5 * ((M_m / d) * sqrt((h / -l))))));
} else {
tmp = w0 * sqrt((1.0 - ((1.0 / l) * (h * pow((D_m * (0.5 * (M_m / d))), 2.0)))));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -5e-8) {
tmp = w0 * Math.hypot(1.0, (D_m * (0.5 * ((M_m / d) * Math.sqrt((h / -l))))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((1.0 / l) * (h * Math.pow((D_m * (0.5 * (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 (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -5e-8: tmp = w0 * math.hypot(1.0, (D_m * (0.5 * ((M_m / d) * math.sqrt((h / -l)))))) else: tmp = w0 * math.sqrt((1.0 - ((1.0 / l) * (h * math.pow((D_m * (0.5 * (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 (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e-8) tmp = Float64(w0 * hypot(1.0, Float64(D_m * Float64(0.5 * Float64(Float64(M_m / d) * sqrt(Float64(h / Float64(-l)))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(1.0 / l) * Float64(h * (Float64(D_m * Float64(0.5 * 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 (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e-8)
tmp = w0 * hypot(1.0, (D_m * (0.5 * ((M_m / d) * sqrt((h / -l))))));
else
tmp = w0 * sqrt((1.0 - ((1.0 / l) * (h * ((D_m * (0.5 * (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[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], -5e-8], N[(w0 * N[Sqrt[1.0 ^ 2 + N[(D$95$m * N[(0.5 * N[(N[(M$95$m / d), $MachinePrecision] * N[Sqrt[N[(h / (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{-8}:\\
\;\;\;\;w0 \cdot \mathsf{hypot}\left(1, D\_m \cdot \left(0.5 \cdot \left(\frac{M\_m}{d} \cdot \sqrt{\frac{h}{-\ell}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{1}{\ell} \cdot \left(h \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}\right)}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.9999999999999998e-8Initial program 62.5%
Simplified64.7%
associate-*r/63.6%
add-sqr-sqrt63.6%
pow263.6%
unpow263.6%
sqrt-prod30.3%
add-sqr-sqrt63.6%
*-un-lft-identity63.6%
times-frac63.6%
metadata-eval63.6%
Applied egg-rr63.6%
*-un-lft-identity63.6%
sub-neg63.6%
associate-/l*64.7%
distribute-rgt-neg-out64.7%
add-sqr-sqrt64.7%
hypot-1-def64.7%
sqrt-prod70.5%
unpow270.5%
sqrt-prod34.9%
add-sqr-sqrt78.3%
associate-*r/78.3%
Applied egg-rr78.3%
*-lft-identity78.3%
associate-*r/77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*r*77.1%
associate-*r/77.1%
*-commutative77.1%
associate-/l*77.1%
associate-*l*77.1%
Simplified77.1%
pow177.1%
associate-*l*82.8%
*-commutative82.8%
Applied egg-rr82.8%
unpow182.8%
associate-*l*82.8%
Simplified82.8%
if -4.9999999999999998e-8 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 83.8%
Simplified83.7%
associate-*r/94.6%
clear-num94.6%
add-sqr-sqrt94.6%
pow294.6%
unpow294.6%
sqrt-prod62.6%
add-sqr-sqrt94.6%
*-un-lft-identity94.6%
times-frac94.6%
metadata-eval94.6%
Applied egg-rr94.6%
associate-/r/94.6%
*-commutative94.6%
associate-*r/94.6%
*-commutative94.6%
associate-/l*94.6%
associate-*l/94.0%
*-commutative94.0%
associate-*l*94.0%
Simplified94.0%
Final simplification90.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 (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e-10) (* w0 (hypot 1.0 (* D_m (* 0.5 (* (/ M_m d) (sqrt (/ h (- l)))))))) w0))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e-10) {
tmp = w0 * hypot(1.0, (D_m * (0.5 * ((M_m / d) * sqrt((h / -l))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e-10) {
tmp = w0 * Math.hypot(1.0, (D_m * (0.5 * ((M_m / d) * Math.sqrt((h / -l))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e-10: tmp = w0 * math.hypot(1.0, (D_m * (0.5 * ((M_m / d) * math.sqrt((h / -l)))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e-10) tmp = Float64(w0 * hypot(1.0, Float64(D_m * Float64(0.5 * Float64(Float64(M_m / d) * sqrt(Float64(h / Float64(-l)))))))); 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 (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e-10)
tmp = w0 * hypot(1.0, (D_m * (0.5 * ((M_m / d) * sqrt((h / -l))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e-10], N[(w0 * N[Sqrt[1.0 ^ 2 + N[(D$95$m * N[(0.5 * N[(N[(M$95$m / d), $MachinePrecision] * N[Sqrt[N[(h / (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-10}:\\
\;\;\;\;w0 \cdot \mathsf{hypot}\left(1, D\_m \cdot \left(0.5 \cdot \left(\frac{M\_m}{d} \cdot \sqrt{\frac{h}{-\ell}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.00000000000000015e-10Initial program 62.9%
Simplified65.1%
associate-*r/64.0%
add-sqr-sqrt64.0%
pow264.0%
unpow264.0%
sqrt-prod30.0%
add-sqr-sqrt64.0%
*-un-lft-identity64.0%
times-frac64.0%
metadata-eval64.0%
Applied egg-rr64.0%
*-un-lft-identity64.0%
sub-neg64.0%
associate-/l*65.1%
distribute-rgt-neg-out65.1%
add-sqr-sqrt65.1%
hypot-1-def65.2%
sqrt-prod70.8%
unpow270.8%
sqrt-prod34.5%
add-sqr-sqrt78.6%
associate-*r/78.6%
Applied egg-rr78.6%
*-lft-identity78.6%
associate-*r/77.3%
*-commutative77.3%
associate-*r*77.3%
*-commutative77.3%
associate-*r*77.3%
*-commutative77.3%
associate-*r*77.3%
*-commutative77.3%
associate-*r*77.3%
associate-*r/77.3%
*-commutative77.3%
associate-/l*77.4%
associate-*l*77.4%
Simplified77.4%
pow177.4%
associate-*l*83.0%
*-commutative83.0%
Applied egg-rr83.0%
unpow183.0%
associate-*l*83.0%
Simplified83.0%
if -4.00000000000000015e-10 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 83.7%
Simplified83.6%
Taylor expanded in M around 0 94.6%
Final simplification90.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(if (<= M_m 7e-16)
w0
(+
w0
(*
-0.125
(* (* (* M_m D_m) (* M_m D_m)) (/ (* h w0) (* 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 <= 7e-16) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h * w0) / (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 <= 7d-16) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((m_m * d_m) * (m_m * d_m)) * ((h * w0) / (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 <= 7e-16) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h * w0) / (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 <= 7e-16: tmp = w0 else: tmp = w0 + (-0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h * w0) / (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 <= 7e-16) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(Float64(h * w0) / 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 <= 7e-16)
tmp = w0;
else
tmp = w0 + (-0.125 * (((M_m * D_m) * (M_m * D_m)) * ((h * w0) / (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, 7e-16], w0, N[(w0 + N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(h * w0), $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 7 \cdot 10^{-16}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \frac{h \cdot w0}{\ell \cdot {d}^{2}}\right)\\
\end{array}
\end{array}
if M < 7.00000000000000035e-16Initial program 76.1%
Simplified76.6%
Taylor expanded in M around 0 69.2%
if 7.00000000000000035e-16 < M Initial program 78.8%
Simplified80.2%
Taylor expanded in M around 0 44.4%
*-un-lft-identity44.4%
associate-*r*45.9%
pow-prod-down61.8%
*-commutative61.8%
Applied egg-rr61.8%
*-lft-identity61.8%
associate-/l*60.4%
*-commutative60.4%
Simplified60.4%
unpow260.4%
Applied egg-rr60.4%
Final simplification67.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 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 76.8%
Simplified77.5%
Taylor expanded in M around 0 65.5%
Final simplification65.5%
herbie shell --seed 2024052
(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))))))