
(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 9 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}
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
:precision binary64
(let* ((t_0 (/ (* M D) (* 2.0 d_m))))
(if (<= (* (pow t_0 2.0) (/ h l)) -5e+282)
(pow
(*
(cbrt w0)
(pow
(exp 0.16666666666666666)
(fma -2.0 (log d_m) (log (* -0.25 (/ (* h (pow (* M D) 2.0)) l))))))
3.0)
(* w0 (sqrt (- 1.0 (/ (* h (pow (pow (cbrt t_0) 3.0) 2.0)) l)))))))d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double t_0 = (M * D) / (2.0 * d_m);
double tmp;
if ((pow(t_0, 2.0) * (h / l)) <= -5e+282) {
tmp = pow((cbrt(w0) * pow(exp(0.16666666666666666), fma(-2.0, log(d_m), log((-0.25 * ((h * pow((M * D), 2.0)) / l)))))), 3.0);
} else {
tmp = w0 * sqrt((1.0 - ((h * pow(pow(cbrt(t_0), 3.0), 2.0)) / l)));
}
return tmp;
}
d_m = abs(d) function code(w0, M, D, h, l, d_m) t_0 = Float64(Float64(M * D) / Float64(2.0 * d_m)) tmp = 0.0 if (Float64((t_0 ^ 2.0) * Float64(h / l)) <= -5e+282) tmp = Float64(cbrt(w0) * (exp(0.16666666666666666) ^ fma(-2.0, log(d_m), log(Float64(-0.25 * Float64(Float64(h * (Float64(M * D) ^ 2.0)) / l)))))) ^ 3.0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * ((cbrt(t_0) ^ 3.0) ^ 2.0)) / l)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+282], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(-2.0 * N[Log[d$95$m], $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d_m}\\
\mathbf{if}\;{t_0}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+282}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d_m, \log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\right)}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left({\left(\sqrt[3]{t_0}\right)}^{3}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.99999999999999978e282Initial program 61.1%
Simplified62.7%
associate-/l*61.1%
*-commutative61.1%
add-sqr-sqrt32.7%
sqrt-unprod55.0%
*-commutative55.0%
*-commutative55.0%
swap-sqr55.0%
metadata-eval55.0%
metadata-eval55.0%
swap-sqr55.0%
sqrt-unprod28.5%
add-sqr-sqrt61.1%
times-frac62.7%
Applied egg-rr62.7%
associate-*l/61.1%
associate-*r/61.1%
associate-*l/61.1%
associate-/l*64.1%
Simplified64.1%
add-cube-cbrt64.0%
pow364.0%
*-commutative64.0%
associate-/r/62.7%
div-inv62.7%
metadata-eval62.7%
Applied egg-rr62.7%
Taylor expanded in d around 0 10.6%
unpow1/330.4%
*-lft-identity30.4%
exp-prod30.4%
+-commutative30.4%
fma-def30.4%
distribute-lft-neg-in30.4%
metadata-eval30.4%
associate-*r*30.5%
unpow230.5%
unpow230.5%
swap-sqr39.5%
unpow239.5%
*-commutative39.5%
Simplified39.5%
if -4.99999999999999978e282 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 86.2%
Simplified85.7%
Applied egg-rr94.0%
add-cube-cbrt93.9%
pow393.9%
associate-*r/94.4%
Applied egg-rr94.4%
Final simplification80.2%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ M (/ (* 2.0 d_m) D)) 2.0))))) w0))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((M / ((2.0 * d_m) / D)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_m)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m / ((2.0d0 * d_m) / d)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((M / ((2.0 * d_m) / D)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): tmp = 0 if (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((M / ((2.0 * d_m) / D)), 2.0)))) else: tmp = w0 return tmp
d_m = abs(d) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(M / Float64(Float64(2.0 * d_m) / D)) ^ 2.0))))); else tmp = w0; end return tmp end
d_m = abs(d); function tmp_2 = code(w0, M, D, h, l, d_m) tmp = 0.0; if (((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -2e-13) tmp = w0 * sqrt((1.0 - ((h / l) * ((M / ((2.0 * d_m) / D)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(M / N[(N[(2.0 * d$95$m), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d_m}{D}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -2.0000000000000001e-13Initial program 70.0%
Simplified70.2%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 84.7%
Simplified84.7%
Taylor expanded in M around 0 94.0%
Final simplification86.0%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (/ D -2.0) (/ d_m M)) 2.0))))) w0))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / -2.0) / (d_m / M)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_m)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d / (-2.0d0)) / (d_m / m)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / -2.0) / (d_m / M)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): tmp = 0 if (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / -2.0) / (d_m / M)), 2.0)))) else: tmp = w0 return tmp
d_m = abs(d) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / -2.0) / Float64(d_m / M)) ^ 2.0))))); else tmp = w0; end return tmp end
d_m = abs(d); function tmp_2 = code(w0, M, D, h, l, d_m) tmp = 0.0; if (((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -2e-13) tmp = w0 * sqrt((1.0 - ((h / l) * (((D / -2.0) / (d_m / M)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / -2.0), $MachinePrecision] / N[(d$95$m / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{\frac{D}{-2}}{\frac{d_m}{M}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -2.0000000000000001e-13Initial program 70.0%
Simplified70.2%
associate-/l*70.0%
*-commutative70.0%
add-sqr-sqrt35.4%
sqrt-unprod59.9%
*-commutative59.9%
*-commutative59.9%
swap-sqr59.9%
metadata-eval59.9%
metadata-eval59.9%
swap-sqr59.9%
sqrt-unprod34.5%
add-sqr-sqrt70.0%
times-frac70.2%
Applied egg-rr70.2%
associate-*l/70.0%
associate-*r/70.0%
associate-*l/70.0%
associate-/l*70.2%
Simplified70.2%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 84.7%
Simplified84.7%
Taylor expanded in M around 0 94.0%
Final simplification86.0%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (if (<= D 5.4e+51) w0 (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ d_m (* M (* D -0.5))) -2.0)))))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 5.4e+51) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((d_m / (M * (D * -0.5))), -2.0))));
}
return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (d <= 5.4d+51) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d_m / (m * (d * (-0.5d0)))) ** (-2.0d0)))))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 5.4e+51) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((d_m / (M * (D * -0.5))), -2.0))));
}
return tmp;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): tmp = 0 if D <= 5.4e+51: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((d_m / (M * (D * -0.5))), -2.0)))) return tmp
d_m = abs(d) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (D <= 5.4e+51) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(d_m / Float64(M * Float64(D * -0.5))) ^ -2.0))))); end return tmp end
d_m = abs(d); function tmp_2 = code(w0, M, D, h, l, d_m) tmp = 0.0; if (D <= 5.4e+51) tmp = w0; else tmp = w0 * sqrt((1.0 - ((h / l) * ((d_m / (M * (D * -0.5))) ^ -2.0)))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[D, 5.4e+51], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(d$95$m / N[(M * N[(D * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;D \leq 5.4 \cdot 10^{+51}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{d_m}{M \cdot \left(D \cdot -0.5\right)}\right)}^{-2}}\\
\end{array}
\end{array}
if D < 5.39999999999999983e51Initial program 78.9%
Simplified78.5%
Taylor expanded in M around 0 71.7%
if 5.39999999999999983e51 < D Initial program 83.1%
Simplified85.0%
associate-/l*83.1%
*-commutative83.1%
add-sqr-sqrt36.7%
sqrt-unprod73.7%
*-commutative73.7%
*-commutative73.7%
swap-sqr73.7%
metadata-eval73.7%
metadata-eval73.7%
swap-sqr73.7%
sqrt-unprod46.4%
add-sqr-sqrt83.1%
times-frac85.0%
Applied egg-rr85.0%
associate-*l/83.1%
associate-*r/83.1%
associate-*l/83.1%
associate-/l*85.0%
Simplified85.0%
clear-num85.0%
inv-pow85.0%
div-inv85.0%
metadata-eval85.0%
Applied egg-rr85.0%
unpow-185.0%
associate-/l/83.1%
Simplified83.1%
associate-*r/81.5%
inv-pow81.5%
pow-pow81.5%
associate-/r*83.4%
metadata-eval83.4%
Applied egg-rr83.4%
associate-*r/85.0%
*-commutative85.0%
associate-/l/83.1%
Simplified83.1%
Final simplification74.0%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (if (<= M 4.7e+39) w0 (* -0.125 (* w0 (* (/ h (pow d_m 2.0)) (/ (pow (* M D) 2.0) l))))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 4.7e+39) {
tmp = w0;
} else {
tmp = -0.125 * (w0 * ((h / pow(d_m, 2.0)) * (pow((M * D), 2.0) / l)));
}
return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (m <= 4.7d+39) then
tmp = w0
else
tmp = (-0.125d0) * (w0 * ((h / (d_m ** 2.0d0)) * (((m * d) ** 2.0d0) / l)))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 4.7e+39) {
tmp = w0;
} else {
tmp = -0.125 * (w0 * ((h / Math.pow(d_m, 2.0)) * (Math.pow((M * D), 2.0) / l)));
}
return tmp;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): tmp = 0 if M <= 4.7e+39: tmp = w0 else: tmp = -0.125 * (w0 * ((h / math.pow(d_m, 2.0)) * (math.pow((M * D), 2.0) / l))) return tmp
d_m = abs(d) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (M <= 4.7e+39) tmp = w0; else tmp = Float64(-0.125 * Float64(w0 * Float64(Float64(h / (d_m ^ 2.0)) * Float64((Float64(M * D) ^ 2.0) / l)))); end return tmp end
d_m = abs(d); function tmp_2 = code(w0, M, D, h, l, d_m) tmp = 0.0; if (M <= 4.7e+39) tmp = w0; else tmp = -0.125 * (w0 * ((h / (d_m ^ 2.0)) * (((M * D) ^ 2.0) / l))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[M, 4.7e+39], w0, N[(-0.125 * N[(w0 * N[(N[(h / N[Power[d$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 4.7 \cdot 10^{+39}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(w0 \cdot \left(\frac{h}{{d_m}^{2}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 4.6999999999999999e39Initial program 81.8%
Simplified81.3%
Taylor expanded in M around 0 68.5%
if 4.6999999999999999e39 < M Initial program 70.5%
Simplified72.8%
Taylor expanded in M around 0 42.1%
*-commutative42.1%
times-frac37.8%
Simplified37.8%
frac-times42.1%
associate-/r*42.2%
associate-*r*46.8%
pow-prod-down64.7%
Applied egg-rr64.7%
Taylor expanded in D around inf 23.5%
Simplified22.8%
Final simplification60.3%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (if (<= M 3.3e+37) w0 (* -0.125 (* w0 (/ (* (* h (pow (* M D) 2.0)) (pow d_m -2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 3.3e+37) {
tmp = w0;
} else {
tmp = -0.125 * (w0 * (((h * pow((M * D), 2.0)) * pow(d_m, -2.0)) / l));
}
return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (m <= 3.3d+37) then
tmp = w0
else
tmp = (-0.125d0) * (w0 * (((h * ((m * d) ** 2.0d0)) * (d_m ** (-2.0d0))) / l))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (M <= 3.3e+37) {
tmp = w0;
} else {
tmp = -0.125 * (w0 * (((h * Math.pow((M * D), 2.0)) * Math.pow(d_m, -2.0)) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): tmp = 0 if M <= 3.3e+37: tmp = w0 else: tmp = -0.125 * (w0 * (((h * math.pow((M * D), 2.0)) * math.pow(d_m, -2.0)) / l)) return tmp
d_m = abs(d) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (M <= 3.3e+37) tmp = w0; else tmp = Float64(-0.125 * Float64(w0 * Float64(Float64(Float64(h * (Float64(M * D) ^ 2.0)) * (d_m ^ -2.0)) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(w0, M, D, h, l, d_m) tmp = 0.0; if (M <= 3.3e+37) tmp = w0; else tmp = -0.125 * (w0 * (((h * ((M * D) ^ 2.0)) * (d_m ^ -2.0)) / l)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[M, 3.3e+37], w0, N[(-0.125 * N[(w0 * N[(N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[d$95$m, -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.3 \cdot 10^{+37}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(w0 \cdot \frac{\left(h \cdot {\left(M \cdot D\right)}^{2}\right) \cdot {d_m}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if M < 3.3000000000000001e37Initial program 81.7%
Simplified81.3%
Taylor expanded in M around 0 68.3%
if 3.3000000000000001e37 < M Initial program 71.1%
Simplified73.3%
Taylor expanded in M around 0 43.3%
*-commutative43.3%
times-frac39.2%
Simplified39.2%
frac-times43.3%
associate-/r*43.4%
associate-*r*47.9%
pow-prod-down65.5%
Applied egg-rr65.5%
Taylor expanded in D around inf 23.1%
Simplified22.4%
expm1-log1p-u1.7%
expm1-udef1.6%
div-inv1.6%
pow-flip1.6%
metadata-eval1.6%
Applied egg-rr1.6%
expm1-def1.7%
expm1-log1p22.4%
associate-*r/22.7%
*-commutative22.7%
associate-*r*24.9%
*-commutative24.9%
Simplified24.9%
Final simplification60.4%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* M (/ D (* 2.0 d_m))) 2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * sqrt((1.0 - ((h * pow((M * (D / (2.0 * d_m))), 2.0)) / l)));
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0 * sqrt((1.0d0 - ((h * ((m * (d / (2.0d0 * d_m))) ** 2.0d0)) / l)))
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow((M * (D / (2.0 * d_m))), 2.0)) / l)));
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): return w0 * math.sqrt((1.0 - ((h * math.pow((M * (D / (2.0 * d_m))), 2.0)) / l)))
d_m = abs(d) function code(w0, M, D, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(D / Float64(2.0 * d_m))) ^ 2.0)) / l)))) end
d_m = abs(d); function tmp = code(w0, M, D, h, l, d_m) tmp = w0 * sqrt((1.0 - ((h * ((M * (D / (2.0 * d_m))) ^ 2.0)) / l))); end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M * N[(D / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \frac{D}{2 \cdot d_m}\right)}^{2}}{\ell}}
\end{array}
Initial program 79.8%
Simplified79.8%
Applied egg-rr86.3%
Final simplification86.3%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (/ (/ d_m (* D -0.5)) M) -2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * sqrt((1.0 - ((h * pow(((d_m / (D * -0.5)) / M), -2.0)) / l)));
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0 * sqrt((1.0d0 - ((h * (((d_m / (d * (-0.5d0))) / m) ** (-2.0d0))) / l)))
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow(((d_m / (D * -0.5)) / M), -2.0)) / l)));
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): return w0 * math.sqrt((1.0 - ((h * math.pow(((d_m / (D * -0.5)) / M), -2.0)) / l)))
d_m = abs(d) function code(w0, M, D, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(d_m / Float64(D * -0.5)) / M) ^ -2.0)) / l)))) end
d_m = abs(d); function tmp = code(w0, M, D, h, l, d_m) tmp = w0 * sqrt((1.0 - ((h * (((d_m / (D * -0.5)) / M) ^ -2.0)) / l))); end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(d$95$m / N[(D * -0.5), $MachinePrecision]), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{\frac{d_m}{D \cdot -0.5}}{M}\right)}^{-2}}{\ell}}
\end{array}
Initial program 79.8%
Simplified79.8%
associate-/l*79.8%
*-commutative79.8%
add-sqr-sqrt39.2%
sqrt-unprod72.5%
*-commutative72.5%
*-commutative72.5%
swap-sqr72.5%
metadata-eval72.5%
metadata-eval72.5%
swap-sqr72.5%
sqrt-unprod40.5%
add-sqr-sqrt79.8%
times-frac79.8%
Applied egg-rr79.8%
associate-*l/79.8%
associate-*r/79.8%
associate-*l/79.8%
associate-/l*79.4%
Simplified79.4%
clear-num79.4%
inv-pow79.4%
div-inv79.4%
metadata-eval79.4%
Applied egg-rr79.4%
unpow-179.4%
associate-/l/79.8%
Simplified79.8%
associate-*r/85.9%
inv-pow85.9%
pow-pow85.9%
associate-/r*86.3%
metadata-eval86.3%
Applied egg-rr86.3%
Final simplification86.3%
d_m = (fabs.f64 d) (FPCore (w0 M D h l d_m) :precision binary64 w0)
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0;
}
d_m = math.fabs(d) def code(w0, M, D, h, l, d_m): return w0
d_m = abs(d) function code(w0, M, D, h, l, d_m) return w0 end
d_m = abs(d); function tmp = code(w0, M, D, h, l, d_m) tmp = w0; end
d_m = N[Abs[d], $MachinePrecision] code[w0_, M_, D_, h_, l_, d$95$m_] := w0
\begin{array}{l}
d_m = \left|d\right|
\\
w0
\end{array}
Initial program 79.8%
Simplified79.8%
Taylor expanded in M around 0 64.8%
Final simplification64.8%
herbie shell --seed 2024017
(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))))))