
(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 12 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}
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-16)
(*
w0
(sqrt (fma (/ (* M D) (* d -2.0)) (* (* M D) (* (/ h l) (/ 0.5 d))) 1.0)))
w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-16) {
tmp = w0 * sqrt(fma(((M * D) / (d * -2.0)), ((M * D) * ((h / l) * (0.5 / d))), 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-16) tmp = Float64(w0 * sqrt(fma(Float64(Float64(M * D) / Float64(d * -2.0)), Float64(Float64(M * D) * Float64(Float64(h / l) * Float64(0.5 / d))), 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-16], N[(w0 * N[Sqrt[N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{d \cdot -2}, \left(M \cdot D\right) \cdot \left(\frac{h}{\ell} \cdot \frac{0.5}{d}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e-16Initial program 66.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
Applied rewrites67.6%
if -2e-16 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.0%
Taylor expanded in M around 0
Applied rewrites99.4%
*-rgt-identity99.4
Applied rewrites99.4%
Final simplification89.0%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-16)
(*
w0
(sqrt (fma (/ M d) (* (* D -0.5) (* (* M D) (/ (* h 0.5) (* d l)))) 1.0)))
w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-16) {
tmp = w0 * sqrt(fma((M / d), ((D * -0.5) * ((M * D) * ((h * 0.5) / (d * l)))), 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-16) tmp = Float64(w0 * sqrt(fma(Float64(M / d), Float64(Float64(D * -0.5) * Float64(Float64(M * D) * Float64(Float64(h * 0.5) / Float64(d * l)))), 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-16], N[(w0 * N[Sqrt[N[(N[(M / d), $MachinePrecision] * N[(N[(D * -0.5), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(h * 0.5), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \left(D \cdot -0.5\right) \cdot \left(\left(M \cdot D\right) \cdot \frac{h \cdot 0.5}{d \cdot \ell}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e-16Initial program 66.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites65.3%
if -2e-16 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.0%
Taylor expanded in M around 0
Applied rewrites99.4%
*-rgt-identity99.4
Applied rewrites99.4%
Final simplification88.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.05) (* w0 (sqrt (fma (/ M d) (/ (* -0.25 (* h (* M (* D D)))) (* d l)) 1.0))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.05) {
tmp = w0 * sqrt(fma((M / d), ((-0.25 * (h * (M * (D * D)))) / (d * l)), 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.05) tmp = Float64(w0 * sqrt(fma(Float64(M / d), Float64(Float64(-0.25 * Float64(h * Float64(M * Float64(D * D)))) / Float64(d * l)), 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.05], N[(w0 * N[Sqrt[N[(N[(M / d), $MachinePrecision] * N[(N[(-0.25 * N[(h * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \frac{-0.25 \cdot \left(h \cdot \left(M \cdot \left(D \cdot D\right)\right)\right)}{d \cdot \ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -0.050000000000000003Initial program 65.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
distribute-lft-neg-inN/A
*-commutativeN/A
Applied rewrites66.8%
lift-*.f64N/A
frac-timesN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6462.7
Applied rewrites62.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites59.3%
Taylor expanded in D around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6453.4
Applied rewrites53.4%
if -0.050000000000000003 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.1%
Taylor expanded in M around 0
Applied rewrites99.1%
*-rgt-identity99.1
Applied rewrites99.1%
Final simplification84.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.0005) (* w0 (sqrt (fma (- (* M D)) (/ (* (* M D) h) (* (* d l) (* d 4.0))) 1.0))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
tmp = w0 * sqrt(fma(-(M * D), (((M * D) * h) / ((d * l) * (d * 4.0))), 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.0005) tmp = Float64(w0 * sqrt(fma(Float64(-Float64(M * D)), Float64(Float64(Float64(M * D) * h) / Float64(Float64(d * l) * Float64(d * 4.0))), 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.0005], N[(w0 * N[Sqrt[N[((-N[(M * D), $MachinePrecision]) * N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d * l), $MachinePrecision] * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{\left(M \cdot D\right) \cdot h}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\right)}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e-4Initial program 65.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
swap-sqrN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval54.0
Applied rewrites54.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
Applied rewrites52.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
lower-*.f6455.6
Applied rewrites55.6%
if -5.0000000000000001e-4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.0%
Taylor expanded in M around 0
Applied rewrites99.4%
*-rgt-identity99.4
Applied rewrites99.4%
Final simplification85.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.05) (* w0 (sqrt (fma (- (* M D)) (/ (* M (* D h)) (* 4.0 (* d (* d l)))) 1.0))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.05) {
tmp = w0 * sqrt(fma(-(M * D), ((M * (D * h)) / (4.0 * (d * (d * l)))), 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.05) tmp = Float64(w0 * sqrt(fma(Float64(-Float64(M * D)), Float64(Float64(M * Float64(D * h)) / Float64(4.0 * Float64(d * Float64(d * l)))), 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.05], N[(w0 * N[Sqrt[N[((-N[(M * D), $MachinePrecision]) * N[(N[(M * N[(D * h), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{M \cdot \left(D \cdot h\right)}{4 \cdot \left(d \cdot \left(d \cdot \ell\right)\right)}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -0.050000000000000003Initial program 65.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
swap-sqrN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval53.5
Applied rewrites53.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
Applied rewrites52.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f6452.0
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6448.1
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6448.1
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6451.2
Applied rewrites51.2%
if -0.050000000000000003 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.1%
Taylor expanded in M around 0
Applied rewrites99.1%
*-rgt-identity99.1
Applied rewrites99.1%
Final simplification83.7%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.0005) (* w0 (sqrt (- 1.0 (* M (* D (/ (* (* M D) h) (* l (* 4.0 (* d d))))))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
tmp = w0 * sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))));
} else {
tmp = w0;
}
return tmp;
}
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
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-0.0005d0)) then
tmp = w0 * sqrt((1.0d0 - (m * (d * (((m * d) * h) / (l * (4.0d0 * (d_1 * d_1))))))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
tmp = w0 * Math.sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005: tmp = w0 * math.sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d)))))))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.0005) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(M * Float64(D * Float64(Float64(Float64(M * D) * h) / Float64(l * Float64(4.0 * Float64(d * d))))))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -0.0005) tmp = w0 * sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d)))))))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.0005], N[(w0 * N[Sqrt[N[(1.0 - N[(M * N[(D * N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(l * N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\
\;\;\;\;w0 \cdot \sqrt{1 - M \cdot \left(D \cdot \frac{\left(M \cdot D\right) \cdot h}{\ell \cdot \left(4 \cdot \left(d \cdot d\right)\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e-4Initial program 65.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
swap-sqrN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval54.0
Applied rewrites54.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
if -5.0000000000000001e-4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.0%
Taylor expanded in M around 0
Applied rewrites99.4%
*-rgt-identity99.4
Applied rewrites99.4%
Final simplification84.3%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+114) (fma (* w0 -0.125) (* (/ (* (* M D) (* M D)) d) (/ h (* d l))) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+114) {
tmp = fma((w0 * -0.125), ((((M * D) * (M * D)) / d) * (h / (d * l))), w0);
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+114) tmp = fma(Float64(w0 * -0.125), Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / d) * Float64(h / Float64(d * l))), w0); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+114], N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\
\;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{h}{d \cdot \ell}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e114Initial program 58.8%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites41.8%
Taylor expanded in w0 around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
lower-/.f6448.9
Applied rewrites48.9%
if -5.0000000000000001e114 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.8%
Taylor expanded in M around 0
Applied rewrites92.9%
*-rgt-identity92.9
Applied rewrites92.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+178) (fma (* w0 -0.125) (* (* (* M D) (* M D)) (/ h (* d (* d l)))) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e+178) {
tmp = fma((w0 * -0.125), (((M * D) * (M * D)) * (h / (d * (d * l)))), w0);
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+178) tmp = fma(Float64(w0 * -0.125), Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(h / Float64(d * Float64(d * l)))), w0); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+178], N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e178Initial program 58.2%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites42.3%
Taylor expanded in w0 around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
lower-/.f6446.1
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6446.2
Applied rewrites46.2%
if -2.0000000000000001e178 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.8%
Taylor expanded in M around 0
Applied rewrites92.5%
*-rgt-identity92.5
Applied rewrites92.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+114) (fma D (* (* w0 -0.125) (/ (* M (* D (* M h))) (* d (* d l)))) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+114) {
tmp = fma(D, ((w0 * -0.125) * ((M * (D * (M * h))) / (d * (d * l)))), w0);
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+114) tmp = fma(D, Float64(Float64(w0 * -0.125) * Float64(Float64(M * Float64(D * Float64(M * h))) / Float64(d * Float64(d * l)))), w0); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+114], N[(D * N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(M * N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\
\;\;\;\;\mathsf{fma}\left(D, \left(w0 \cdot -0.125\right) \cdot \frac{M \cdot \left(D \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e114Initial program 58.8%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites41.8%
Taylor expanded in w0 around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lower-+.f64N/A
Applied rewrites43.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites47.1%
if -5.0000000000000001e114 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.8%
Taylor expanded in M around 0
Applied rewrites92.9%
*-rgt-identity92.9
Applied rewrites92.9%
Final simplification80.6%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+219) (* (* (* D D) (* M (* -0.125 (* M h)))) (/ w0 (* d (* d l)))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219) {
tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)));
} else {
tmp = w0;
}
return tmp;
}
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
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+219)) then
tmp = ((d * d) * (m * ((-0.125d0) * (m * h)))) * (w0 / (d_1 * (d_1 * l)))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219) {
tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219: tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+219) tmp = Float64(Float64(Float64(D * D) * Float64(M * Float64(-0.125 * Float64(M * h)))) * Float64(w0 / Float64(d * Float64(d * l)))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+219) tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+219], N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(-0.125 * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+219}:\\
\;\;\;\;\left(\left(D \cdot D\right) \cdot \left(M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)\right)\right) \cdot \frac{w0}{d \cdot \left(d \cdot \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5e219Initial program 57.6%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites42.9%
Taylor expanded in w0 around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.5
Applied rewrites38.5%
Taylor expanded in D around inf
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.5
Applied rewrites38.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites40.2%
if -5e219 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.9%
Taylor expanded in M around 0
Applied rewrites92.0%
*-rgt-identity92.0
Applied rewrites92.0%
Final simplification78.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) (- INFINITY)) (* (* D D) (* w0 (/ (* M (* -0.125 (* M h))) (* d (* d l))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -((double) INFINITY)) {
tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -Double.POSITIVE_INFINITY) {
tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -math.inf: tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= Float64(-Inf)) tmp = Float64(Float64(D * D) * Float64(w0 * Float64(Float64(M * Float64(-0.125 * Float64(M * h))) / Float64(d * Float64(d * l))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -Inf) tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(D * D), $MachinePrecision] * N[(w0 * N[(N[(M * N[(-0.125 * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
\;\;\;\;\left(D \cdot D\right) \cdot \left(w0 \cdot \frac{M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0Initial program 55.6%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites44.8%
Taylor expanded in w0 around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.2
Applied rewrites40.2%
Taylor expanded in D around inf
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.1
Applied rewrites40.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.3
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6442.0
Applied rewrites42.0%
if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 90.1%
Taylor expanded in M around 0
Applied rewrites90.7%
*-rgt-identity90.7
Applied rewrites90.7%
Final simplification78.5%
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
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
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
def code(w0, M, D, h, l, d): return w0
function code(w0, M, D, h, l, d) return w0 end
function tmp = code(w0, M, D, h, l, d) tmp = w0; end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
\\
w0
\end{array}
Initial program 81.4%
Taylor expanded in M around 0
Applied rewrites69.1%
*-rgt-identity69.1
Applied rewrites69.1%
herbie shell --seed 2024221
(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))))))