
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+143)
(*
w0
(sqrt
(-
1.0
(/
h
(* (* (/ d_m (* M_m (* D_m 0.5))) (/ (* 2.0 d_m) (* M_m D_m))) l)))))
(pow
(*
(cbrt w0)
(*
(* (pow (/ (* h -0.25) l) 0.16666666666666666) (cbrt (* M_m D_m)))
(exp (* -0.3333333333333333 (log d_m)))))
3.0)))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
tmp = w0 * sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
} else {
tmp = pow((cbrt(w0) * ((pow(((h * -0.25) / l), 0.16666666666666666) * cbrt((M_m * D_m))) * exp((-0.3333333333333333 * log(d_m))))), 3.0);
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
tmp = w0 * Math.sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
} else {
tmp = Math.pow((Math.cbrt(w0) * ((Math.pow(((h * -0.25) / l), 0.16666666666666666) * Math.cbrt((M_m * D_m))) * Math.exp((-0.3333333333333333 * Math.log(d_m))))), 3.0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+143) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h / Float64(Float64(Float64(d_m / Float64(M_m * Float64(D_m * 0.5))) * Float64(Float64(2.0 * d_m) / Float64(M_m * D_m))) * l))))); else tmp = Float64(cbrt(w0) * Float64(Float64((Float64(Float64(h * -0.25) / l) ^ 0.16666666666666666) * cbrt(Float64(M_m * D_m))) * exp(Float64(-0.3333333333333333 * log(d_m))))) ^ 3.0; end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+143], N[(w0 * N[Sqrt[N[(1.0 - N[(h / N[(N[(N[(d$95$m / N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * d$95$m), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[(N[(N[Power[N[(N[(h * -0.25), $MachinePrecision] / l), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(-0.3333333333333333 * N[Log[d$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot \left(\left({\left(\frac{h \cdot -0.25}{\ell}\right)}^{0.16666666666666666} \cdot \sqrt[3]{M\_m \cdot D\_m}\right) \cdot e^{-0.3333333333333333 \cdot \log d\_m}\right)\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000012e143Initial program 90.6%
Simplified89.4%
associate-*r/90.6%
unpow290.6%
associate-/r*90.6%
frac-times70.4%
associate-/l*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
clear-num70.4%
frac-times74.5%
*-un-lft-identity74.5%
times-frac95.0%
*-commutative95.0%
*-commutative95.0%
Applied egg-rr95.0%
if 5.00000000000000012e143 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 70.6%
Simplified70.6%
add-cube-cbrt70.6%
pow370.6%
Applied egg-rr70.6%
Taylor expanded in d around 0 39.1%
exp-prod39.1%
unpow-prod-up39.1%
distribute-lft-neg-in39.1%
metadata-eval39.1%
associate-*r*43.0%
pow-prod-down45.9%
*-commutative45.9%
Applied egg-rr45.9%
exp-prod45.9%
exp-prod46.1%
*-commutative46.1%
exp-to-pow46.2%
associate-/l*46.2%
*-commutative46.2%
associate-*r*46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in D around 0 49.5%
Final simplification90.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+143)
(*
w0
(sqrt
(-
1.0
(/
h
(* (* (/ d_m (* M_m (* D_m 0.5))) (/ (* 2.0 d_m) (* M_m D_m))) l)))))
(pow
(*
(pow (* -0.25 (/ h l)) 0.16666666666666666)
(cbrt (* D_m (/ (* M_m w0) d_m))))
3.0)))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
tmp = w0 * sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
} else {
tmp = pow((pow((-0.25 * (h / l)), 0.16666666666666666) * cbrt((D_m * ((M_m * w0) / d_m)))), 3.0);
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
tmp = w0 * Math.sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
} else {
tmp = Math.pow((Math.pow((-0.25 * (h / l)), 0.16666666666666666) * Math.cbrt((D_m * ((M_m * w0) / d_m)))), 3.0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+143) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h / Float64(Float64(Float64(d_m / Float64(M_m * Float64(D_m * 0.5))) * Float64(Float64(2.0 * d_m) / Float64(M_m * D_m))) * l))))); else tmp = Float64((Float64(-0.25 * Float64(h / l)) ^ 0.16666666666666666) * cbrt(Float64(D_m * Float64(Float64(M_m * w0) / d_m)))) ^ 3.0; end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+143], N[(w0 * N[Sqrt[N[(1.0 - N[(h / N[(N[(N[(d$95$m / N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * d$95$m), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m * w0), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(-0.25 \cdot \frac{h}{\ell}\right)}^{0.16666666666666666} \cdot \sqrt[3]{D\_m \cdot \frac{M\_m \cdot w0}{d\_m}}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000012e143Initial program 90.6%
Simplified89.4%
associate-*r/90.6%
unpow290.6%
associate-/r*90.6%
frac-times70.4%
associate-/l*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
clear-num70.4%
frac-times74.5%
*-un-lft-identity74.5%
times-frac95.0%
*-commutative95.0%
*-commutative95.0%
Applied egg-rr95.0%
if 5.00000000000000012e143 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 70.6%
Simplified70.6%
add-cube-cbrt70.6%
pow370.6%
Applied egg-rr70.6%
Taylor expanded in d around 0 39.1%
exp-prod39.1%
unpow-prod-up39.1%
distribute-lft-neg-in39.1%
metadata-eval39.1%
associate-*r*43.0%
pow-prod-down45.9%
*-commutative45.9%
Applied egg-rr45.9%
exp-prod45.9%
exp-prod46.1%
*-commutative46.1%
exp-to-pow46.2%
associate-/l*46.2%
*-commutative46.2%
associate-*r*46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in w0 around 0 81.1%
associate-/l*81.1%
associate-/l*84.4%
Simplified84.4%
Final simplification93.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ h l) -5e-312)
(*
w0
(sqrt
(-
1.0
(*
(* M_m (* 0.5 (/ D_m d_m)))
(/ (/ h l) (/ (* 2.0 (/ d_m D_m)) M_m))))))
w0))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-312) {
tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * ((h / l) / ((2.0 * (d_m / D_m)) / M_m)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if ((h / l) <= (-5d-312)) then
tmp = w0 * sqrt((1.0d0 - ((m_m * (0.5d0 * (d_m / d_m_1))) * ((h / l) / ((2.0d0 * (d_m_1 / d_m)) / m_m)))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-312) {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * ((h / l) / ((2.0 * (d_m / D_m)) / M_m)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (h / l) <= -5e-312: tmp = w0 * math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * ((h / l) / ((2.0 * (d_m / D_m)) / M_m))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -5e-312) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) * Float64(Float64(h / l) / Float64(Float64(2.0 * Float64(d_m / D_m)) / M_m)))))); else tmp = w0; end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) tmp = 0.0; if ((h / l) <= -5e-312) tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * ((h / l) / ((2.0 * (d_m / D_m)) / M_m))))); else tmp = w0; end tmp_2 = tmp; end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-312], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[(N[(2.0 * N[(d$95$m / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-312}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right) \cdot \frac{\frac{h}{\ell}}{\frac{2 \cdot \frac{d\_m}{D\_m}}{M\_m}}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.0000000000022e-312Initial program 84.7%
Simplified83.4%
unpow283.4%
associate-*r/83.4%
clear-num83.4%
un-div-inv83.4%
*-un-lft-identity83.4%
times-frac83.4%
metadata-eval83.4%
times-frac83.4%
Applied egg-rr83.4%
associate-*l/86.0%
associate-*r/86.0%
frac-times85.4%
*-commutative85.4%
times-frac84.7%
Applied egg-rr84.7%
associate-/l*84.7%
associate-/l*84.7%
times-frac85.4%
*-commutative85.4%
*-commutative85.4%
associate-*r/85.4%
associate-/r*86.0%
associate-/l*86.0%
Simplified86.0%
if -5.0000000000022e-312 < (/.f64 h l) Initial program 93.7%
Simplified92.8%
Taylor expanded in M around 0 97.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ h l) -5e-312)
(*
w0
(sqrt
(-
1.0
(*
(* M_m (* 0.5 (/ D_m d_m)))
(* 0.5 (* D_m (* (/ h l) (/ M_m d_m))))))))
w0))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-312) {
tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
real(8) :: tmp
if ((h / l) <= (-5d-312)) then
tmp = w0 * sqrt((1.0d0 - ((m_m * (0.5d0 * (d_m / d_m_1))) * (0.5d0 * (d_m * ((h / l) * (m_m / d_m_1)))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-312) {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (h / l) <= -5e-312: tmp = w0 * math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m))))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -5e-312) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) * Float64(0.5 * Float64(D_m * Float64(Float64(h / l) * Float64(M_m / d_m)))))))); else tmp = w0; end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) tmp = 0.0; if ((h / l) <= -5e-312) tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m))))))); else tmp = w0; end tmp_2 = tmp; end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-312], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(h / l), $MachinePrecision] * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-312}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right) \cdot \left(0.5 \cdot \left(D\_m \cdot \left(\frac{h}{\ell} \cdot \frac{M\_m}{d\_m}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.0000000000022e-312Initial program 84.7%
Simplified83.4%
unpow283.4%
associate-*r/83.4%
clear-num83.4%
un-div-inv83.4%
*-un-lft-identity83.4%
times-frac83.4%
metadata-eval83.4%
times-frac83.4%
Applied egg-rr83.4%
associate-*l/86.0%
associate-*r/86.0%
frac-times85.4%
*-commutative85.4%
times-frac84.7%
Applied egg-rr84.7%
associate-/l*84.7%
associate-/l*84.7%
times-frac85.4%
*-commutative85.4%
*-commutative85.4%
associate-*r/85.4%
associate-/r*86.0%
associate-/l*86.0%
Simplified86.0%
Taylor expanded in h around 0 83.7%
associate-/l*81.1%
*-commutative81.1%
*-commutative81.1%
times-frac82.7%
Simplified82.7%
if -5.0000000000022e-312 < (/.f64 h l) Initial program 93.7%
Simplified92.8%
Taylor expanded in M around 0 97.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(*
w0
(sqrt
(-
1.0
(/ h (* (/ d_m (* M_m (* D_m 0.5))) (* l (/ (* 2.0 (/ d_m D_m)) M_m))))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h / ((d_m / (M_m * (D_m * 0.5))) * (l * ((2.0 * (d_m / D_m)) / M_m))))));
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h / ((d_m_1 / (m_m * (d_m * 0.5d0))) * (l * ((2.0d0 * (d_m_1 / d_m)) / m_m))))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h / ((d_m / (M_m * (D_m * 0.5))) * (l * ((2.0 * (d_m / D_m)) / M_m))))));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h / ((d_m / (M_m * (D_m * 0.5))) * (l * ((2.0 * (d_m / D_m)) / M_m))))))
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h / Float64(Float64(d_m / Float64(M_m * Float64(D_m * 0.5))) * Float64(l * Float64(Float64(2.0 * Float64(d_m / D_m)) / M_m))))))) end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp = code(w0, M_m, D_m, h, l, d_m) tmp = w0 * sqrt((1.0 - (h / ((d_m / (M_m * (D_m * 0.5))) * (l * ((2.0 * (d_m / D_m)) / M_m)))))); end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h / N[(N[(d$95$m / N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l * N[(N[(2.0 * N[(d$95$m / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
w0 \cdot \sqrt{1 - \frac{h}{\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \left(\ell \cdot \frac{2 \cdot \frac{d\_m}{D\_m}}{M\_m}\right)}}
\end{array}
Initial program 88.6%
Simplified87.5%
associate-*r/88.6%
unpow288.6%
associate-/r*88.6%
frac-times70.4%
associate-/l*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
clear-num70.4%
frac-times74.1%
*-un-lft-identity74.1%
times-frac92.5%
*-commutative92.5%
*-commutative92.5%
Applied egg-rr92.5%
pow192.5%
Applied egg-rr93.4%
unpow193.4%
associate-*l*93.4%
*-commutative93.4%
*-commutative93.4%
times-frac93.6%
*-commutative93.6%
*-commutative93.6%
associate-*r/93.6%
associate-/r*92.2%
associate-/l*92.2%
Simplified92.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(*
w0
(sqrt
(-
1.0
(/ h (* (* (/ d_m (* M_m (* D_m 0.5))) (/ (* 2.0 d_m) (* M_m D_m))) l))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
code = w0 * sqrt((1.0d0 - (h / (((d_m_1 / (m_m * (d_m * 0.5d0))) * ((2.0d0 * d_m_1) / (m_m * d_m))) * l))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))))
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h / Float64(Float64(Float64(d_m / Float64(M_m * Float64(D_m * 0.5))) * Float64(Float64(2.0 * d_m) / Float64(M_m * D_m))) * l))))) end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp = code(w0, M_m, D_m, h, l, d_m) tmp = w0 * sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l)))); end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h / N[(N[(N[(d$95$m / N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * d$95$m), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}
\end{array}
Initial program 88.6%
Simplified87.5%
associate-*r/88.6%
unpow288.6%
associate-/r*88.6%
frac-times70.4%
associate-/l*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
clear-num70.4%
frac-times74.1%
*-un-lft-identity74.1%
times-frac92.5%
*-commutative92.5%
*-commutative92.5%
Applied egg-rr92.5%
Final simplification92.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) (FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
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_m_1
code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): return w0
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) return w0 end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp = code(w0, M_m, D_m, h, l, d_m) tmp = w0; end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
w0
\end{array}
Initial program 88.6%
Simplified87.5%
Taylor expanded in M around 0 71.1%
herbie shell --seed 2024166
(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))))))