
(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 19 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
(let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))
(t_1 (* D (* M (/ 0.5 d)))))
(if (<= t_0 2e+242)
(* w0 (sqrt t_0))
(* w0 (sqrt (fma (* h t_1) (* (/ -1.0 l) t_1) 1.0))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
double t_1 = D * (M * (0.5 / d));
double tmp;
if (t_0 <= 2e+242) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt(fma((h * t_1), ((-1.0 / l) * t_1), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) t_1 = Float64(D * Float64(M * Float64(0.5 / d))) tmp = 0.0 if (t_0 <= 2e+242) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(fma(Float64(h * t_1), Float64(Float64(-1.0 / l) * t_1), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+242], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(h * t$95$1), $MachinePrecision] * N[(N[(-1.0 / l), $MachinePrecision] * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+242}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot t\_1, \frac{-1}{\ell} \cdot t\_1, 1\right)}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 2.0000000000000001e242Initial program 100.0%
if 2.0000000000000001e242 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 42.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites71.1%
lift-fma.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites72.6%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) 2e+242)
(*
w0
(sqrt (fma (* (/ h l) (/ (* (* D M) -0.5) d)) (* (* (/ 0.5 d) M) D) 1.0)))
(*
w0
(sqrt
(fma (* h (* D (* M (/ 0.5 d)))) (* (* -0.5 (/ D d)) (/ M l)) 1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 2e+242) {
tmp = w0 * sqrt(fma(((h / l) * (((D * M) * -0.5) / d)), (((0.5 / d) * M) * D), 1.0));
} else {
tmp = w0 * sqrt(fma((h * (D * (M * (0.5 / d)))), ((-0.5 * (D / d)) * (M / l)), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 2e+242) tmp = Float64(w0 * sqrt(fma(Float64(Float64(h / l) * Float64(Float64(Float64(D * M) * -0.5) / d)), Float64(Float64(Float64(0.5 / d) * M) * D), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(h * Float64(D * Float64(M * Float64(0.5 / d)))), Float64(Float64(-0.5 * Float64(D / d)) * Float64(M / l)), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[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], 2e+242], N[(w0 * N[Sqrt[N[(N[(N[(h / l), $MachinePrecision] * N[(N[(N[(D * M), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(h * N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{+242}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell} \cdot \frac{\left(D \cdot M\right) \cdot -0.5}{d}, \left(\frac{0.5}{d} \cdot M\right) \cdot D, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right), \left(-0.5 \cdot \frac{D}{d}\right) \cdot \frac{M}{\ell}, 1\right)}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 2.0000000000000001e242Initial program 100.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-pow.f64N/A
unpow2N/A
distribute-lft-neg-inN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites97.8%
if 2.0000000000000001e242 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 42.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites71.1%
lift-fma.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites72.6%
Taylor expanded in M around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6468.9
Applied rewrites68.9%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) 2.0)
(* w0 1.0)
(*
w0
(sqrt
(fma (* h (* D (* M (/ 0.5 d)))) (* (* -0.5 (/ D d)) (/ M l)) 1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 2.0) {
tmp = w0 * 1.0;
} else {
tmp = w0 * sqrt(fma((h * (D * (M * (0.5 / d)))), ((-0.5 * (D / d)) * (M / l)), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 2.0) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * sqrt(fma(Float64(h * Float64(D * Float64(M * Float64(0.5 / d)))), Float64(Float64(-0.5 * Float64(D / d)) * Float64(M / l)), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[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], 2.0], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(h * N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right), \left(-0.5 \cdot \frac{D}{d}\right) \cdot \frac{M}{\ell}, 1\right)}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 2Initial program 100.0%
Taylor expanded in M around 0
Applied rewrites99.7%
if 2 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 51.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-fma.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites72.9%
Taylor expanded in M around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6467.9
Applied rewrites67.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+23) (* w0 (sqrt (fma (* (* (/ D d) M) (* 0.25 M)) (* (/ (- D) d) (/ h l)) 1.0))) (* w0 1.0)))
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+23) {
tmp = w0 * sqrt(fma((((D / d) * M) * (0.25 * M)), ((-D / d) * (h / l)), 1.0));
} else {
tmp = w0 * 1.0;
}
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+23) tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(D / d) * M) * Float64(0.25 * M)), Float64(Float64(Float64(-D) / d) * Float64(h / l)), 1.0))); else tmp = Float64(w0 * 1.0); 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+23], N[(w0 * N[Sqrt[N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * N[(0.25 * M), $MachinePrecision]), $MachinePrecision] * N[(N[((-D) / d), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+23}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\left(\frac{D}{d} \cdot M\right) \cdot \left(0.25 \cdot M\right), \frac{-D}{d} \cdot \frac{h}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -4.9999999999999999e23Initial program 67.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
associate-/l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
Applied rewrites64.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
if -4.9999999999999999e23 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 86.9%
Taylor expanded in M around 0
Applied rewrites96.1%
Final simplification87.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+17) (* w0 (sqrt (fma (* h -0.25) (* M (* (* D M) (/ (/ D d) (* d l)))) 1.0))) (* w0 1.0)))
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+17) {
tmp = w0 * sqrt(fma((h * -0.25), (M * ((D * M) * ((D / d) / (d * l)))), 1.0));
} else {
tmp = w0 * 1.0;
}
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+17) tmp = Float64(w0 * sqrt(fma(Float64(h * -0.25), Float64(M * Float64(Float64(D * M) * Float64(Float64(D / d) / Float64(d * l)))), 1.0))); else tmp = Float64(w0 * 1.0); 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+17], N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] * N[(M * N[(N[(D * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+17}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot -0.25, M \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{D}{d}}{d \cdot \ell}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -2e17Initial program 67.8%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
distribute-lft-inN/A
associate-*r*N/A
rgt-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites42.5%
Applied rewrites45.6%
Applied rewrites60.1%
if -2e17 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 86.8%
Taylor expanded in M around 0
Applied rewrites97.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -1e+38) (* w0 (sqrt (* (* -0.25 (* D D)) (* (/ (* M M) d) (/ h (* d l)))))) (* w0 1.0)))
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)) <= -1e+38) {
tmp = w0 * sqrt(((-0.25 * (D * D)) * (((M * M) / d) * (h / (d * l)))));
} else {
tmp = w0 * 1.0;
}
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)) <= (-1d+38)) then
tmp = w0 * sqrt((((-0.25d0) * (d * d)) * (((m * m) / d_1) * (h / (d_1 * l)))))
else
tmp = w0 * 1.0d0
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)) <= -1e+38) {
tmp = w0 * Math.sqrt(((-0.25 * (D * D)) * (((M * M) / d) * (h / (d * l)))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -1e+38: tmp = w0 * math.sqrt(((-0.25 * (D * D)) * (((M * M) / d) * (h / (d * l))))) else: tmp = w0 * 1.0 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)) <= -1e+38) tmp = Float64(w0 * sqrt(Float64(Float64(-0.25 * Float64(D * D)) * Float64(Float64(Float64(M * M) / d) * Float64(h / Float64(d * l)))))); else tmp = Float64(w0 * 1.0); 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)) <= -1e+38) tmp = w0 * sqrt(((-0.25 * (D * D)) * (((M * M) / d) * (h / (d * l))))); else tmp = w0 * 1.0; 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], -1e+38], N[(w0 * N[Sqrt[N[(N[(-0.25 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+38}:\\
\;\;\;\;w0 \cdot \sqrt{\left(-0.25 \cdot \left(D \cdot D\right)\right) \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d \cdot \ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -9.99999999999999977e37Initial program 66.5%
Taylor expanded in M around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6441.1
Applied rewrites41.1%
Applied rewrites52.6%
if -9.99999999999999977e37 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 87.0%
Taylor expanded in M around 0
Applied rewrites95.6%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+17) (* w0 (sqrt (fma (* h -0.25) (* M (* (* D M) (/ D (* (* d l) d)))) 1.0))) (* w0 1.0)))
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+17) {
tmp = w0 * sqrt(fma((h * -0.25), (M * ((D * M) * (D / ((d * l) * d)))), 1.0));
} else {
tmp = w0 * 1.0;
}
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+17) tmp = Float64(w0 * sqrt(fma(Float64(h * -0.25), Float64(M * Float64(Float64(D * M) * Float64(D / Float64(Float64(d * l) * d)))), 1.0))); else tmp = Float64(w0 * 1.0); 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+17], N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] * N[(M * N[(N[(D * M), $MachinePrecision] * N[(D / N[(N[(d * l), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+17}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot -0.25, M \cdot \left(\left(D \cdot M\right) \cdot \frac{D}{\left(d \cdot \ell\right) \cdot d}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -2e17Initial program 67.8%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
distribute-lft-inN/A
associate-*r*N/A
rgt-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites42.5%
Applied rewrites45.6%
Applied rewrites50.9%
if -2e17 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 86.8%
Taylor expanded in M around 0
Applied rewrites97.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+17) (* w0 (sqrt (fma (* h -0.25) (* M (* (* D M) (/ D (* (* d d) l)))) 1.0))) (* w0 1.0)))
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+17) {
tmp = w0 * sqrt(fma((h * -0.25), (M * ((D * M) * (D / ((d * d) * l)))), 1.0));
} else {
tmp = w0 * 1.0;
}
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+17) tmp = Float64(w0 * sqrt(fma(Float64(h * -0.25), Float64(M * Float64(Float64(D * M) * Float64(D / Float64(Float64(d * d) * l)))), 1.0))); else tmp = Float64(w0 * 1.0); 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+17], N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] * N[(M * N[(N[(D * M), $MachinePrecision] * N[(D / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+17}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot -0.25, M \cdot \left(\left(D \cdot M\right) \cdot \frac{D}{\left(d \cdot d\right) \cdot \ell}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -2e17Initial program 67.8%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
distribute-lft-inN/A
associate-*r*N/A
rgt-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites42.5%
Applied rewrites45.6%
if -2e17 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 86.8%
Taylor expanded in M around 0
Applied rewrites97.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+19) (* w0 (sqrt (* (* -0.25 (* D D)) (* M (/ (* h M) (* (* d d) l)))))) (* w0 1.0)))
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+19) {
tmp = w0 * sqrt(((-0.25 * (D * D)) * (M * ((h * M) / ((d * d) * l)))));
} else {
tmp = w0 * 1.0;
}
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)) <= (-2d+19)) then
tmp = w0 * sqrt((((-0.25d0) * (d * d)) * (m * ((h * m) / ((d_1 * d_1) * l)))))
else
tmp = w0 * 1.0d0
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)) <= -2e+19) {
tmp = w0 * Math.sqrt(((-0.25 * (D * D)) * (M * ((h * M) / ((d * d) * l)))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e+19: tmp = w0 * math.sqrt(((-0.25 * (D * D)) * (M * ((h * M) / ((d * d) * l))))) else: tmp = w0 * 1.0 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+19) tmp = Float64(w0 * sqrt(Float64(Float64(-0.25 * Float64(D * D)) * Float64(M * Float64(Float64(h * M) / Float64(Float64(d * d) * l)))))); else tmp = Float64(w0 * 1.0); 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)) <= -2e+19) tmp = w0 * sqrt(((-0.25 * (D * D)) * (M * ((h * M) / ((d * d) * l))))); else tmp = w0 * 1.0; 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], -2e+19], N[(w0 * N[Sqrt[N[(N[(-0.25 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(M * N[(N[(h * M), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+19}:\\
\;\;\;\;w0 \cdot \sqrt{\left(-0.25 \cdot \left(D \cdot D\right)\right) \cdot \left(M \cdot \frac{h \cdot M}{\left(d \cdot d\right) \cdot \ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -2e19Initial program 67.4%
Taylor expanded in M around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6440.0
Applied rewrites40.0%
Applied rewrites42.8%
if -2e19 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 86.9%
Taylor expanded in M around 0
Applied rewrites96.5%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 5e-129)
(* w0 (sqrt (fma (* h -0.25) (/ (* (* (/ (* M M) d) (/ D d)) D) l) 1.0)))
(*
w0
(sqrt
(fma (/ (* (* D M) -0.5) d) (/ (* (* h D) (* M 0.5)) (* l d)) 1.0)))))
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) <= 5e-129) {
tmp = w0 * sqrt(fma((h * -0.25), (((((M * M) / d) * (D / d)) * D) / l), 1.0));
} else {
tmp = w0 * sqrt(fma((((D * M) * -0.5) / d), (((h * D) * (M * 0.5)) / (l * d)), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 5e-129) tmp = Float64(w0 * sqrt(fma(Float64(h * -0.25), Float64(Float64(Float64(Float64(Float64(M * M) / d) * Float64(D / d)) * D) / l), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(D * M) * -0.5) / d), Float64(Float64(Float64(h * D) * Float64(M * 0.5)) / Float64(l * d)), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 5e-129], N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] * N[(N[(N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(N[(D * M), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(h * D), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 5 \cdot 10^{-129}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot -0.25, \frac{\left(\frac{M \cdot M}{d} \cdot \frac{D}{d}\right) \cdot D}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\left(D \cdot M\right) \cdot -0.5}{d}, \frac{\left(h \cdot D\right) \cdot \left(M \cdot 0.5\right)}{\ell \cdot d}, 1\right)}\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) < 5.00000000000000027e-129Initial program 88.1%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
distribute-lft-inN/A
associate-*r*N/A
rgt-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites75.0%
Applied rewrites86.4%
if 5.00000000000000027e-129 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) Initial program 72.8%
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
lower-fma.f64N/A
Applied rewrites70.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-*.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.5
Applied rewrites73.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) (- INFINITY)) (fma (* (* D D) -0.125) (* (* (/ (* M M) d) h) (/ w0 (* l d))) w0) (* w0 1.0)))
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 = fma(((D * D) * -0.125), ((((M * M) / d) * h) * (w0 / (l * d))), w0);
} else {
tmp = w0 * 1.0;
}
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 = fma(Float64(Float64(D * D) * -0.125), Float64(Float64(Float64(Float64(M * M) / d) * h) * Float64(w0 / Float64(l * d))), w0); else tmp = Float64(w0 * 1.0); 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], (-Infinity)], N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(w0 / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, \left(\frac{M \cdot M}{d} \cdot h\right) \cdot \frac{w0}{\ell \cdot d}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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 58.4%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites44.1%
Applied rewrites42.1%
Applied rewrites52.8%
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 87.9%
Taylor expanded in M around 0
Applied rewrites89.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+175) (fma (* (* D D) -0.125) (/ (* (* M (* h M)) w0) (* d (* l d))) w0) (* w0 1.0)))
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+175) {
tmp = fma(((D * D) * -0.125), (((M * (h * M)) * w0) / (d * (l * d))), w0);
} else {
tmp = w0 * 1.0;
}
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+175) tmp = fma(Float64(Float64(D * D) * -0.125), Float64(Float64(Float64(M * Float64(h * M)) * w0) / Float64(d * Float64(l * d))), w0); else tmp = Float64(w0 * 1.0); 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+175], N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+175}:\\
\;\;\;\;\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, \frac{\left(M \cdot \left(h \cdot M\right)\right) \cdot w0}{d \cdot \left(\ell \cdot d\right)}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -1.9999999999999999e175Initial program 62.9%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites39.4%
Applied rewrites42.7%
if -1.9999999999999999e175 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 87.5%
Taylor expanded in M around 0
Applied rewrites92.4%
Final simplification80.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) (- INFINITY)) (fma (* (* D D) -0.125) (* (* (* M M) h) (/ w0 (* (* l d) d))) w0) (* w0 1.0)))
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 = fma(((D * D) * -0.125), (((M * M) * h) * (w0 / ((l * d) * d))), w0);
} else {
tmp = w0 * 1.0;
}
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 = fma(Float64(Float64(D * D) * -0.125), Float64(Float64(Float64(M * M) * h) * Float64(w0 / Float64(Float64(l * d) * d))), w0); else tmp = Float64(w0 * 1.0); 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], (-Infinity)], N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * N[(w0 / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, \left(\left(M \cdot M\right) \cdot h\right) \cdot \frac{w0}{\left(\ell \cdot d\right) \cdot d}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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 58.4%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites44.1%
Applied rewrites42.1%
Applied rewrites47.6%
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 87.9%
Taylor expanded in M around 0
Applied rewrites89.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+175) (fma (* (* D D) -0.125) (* M (* M (* (/ w0 (* (* d d) l)) h))) w0) (* w0 1.0)))
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+175) {
tmp = fma(((D * D) * -0.125), (M * (M * ((w0 / ((d * d) * l)) * h))), w0);
} else {
tmp = w0 * 1.0;
}
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+175) tmp = fma(Float64(Float64(D * D) * -0.125), Float64(M * Float64(M * Float64(Float64(w0 / Float64(Float64(d * d) * l)) * h))), w0); else tmp = Float64(w0 * 1.0); 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+175], N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(M * N[(M * N[(N[(w0 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\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^{+175}:\\
\;\;\;\;\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, M \cdot \left(M \cdot \left(\frac{w0}{\left(d \cdot d\right) \cdot \ell} \cdot h\right)\right), w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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)) < -1.9999999999999999e175Initial program 62.9%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites39.4%
Applied rewrites37.6%
Applied rewrites39.7%
if -1.9999999999999999e175 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 87.5%
Taylor expanded in M around 0
Applied rewrites92.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) (- INFINITY)) (fma (* w0 -0.125) (/ (* (* (* (* M M) h) D) D) (* (* d d) l)) w0) (* w0 1.0)))
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 = fma((w0 * -0.125), (((((M * M) * h) * D) * D) / ((d * d) * l)), w0);
} else {
tmp = w0 * 1.0;
}
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 = fma(Float64(w0 * -0.125), Float64(Float64(Float64(Float64(Float64(M * M) * h) * D) * D) / Float64(Float64(d * d) * l)), w0); else tmp = Float64(w0 * 1.0); 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], (-Infinity)], N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell}, w0\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\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 58.4%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites44.1%
Applied rewrites42.1%
Taylor expanded in w0 around 0
Applied rewrites44.2%
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 87.9%
Taylor expanded in M around 0
Applied rewrites89.4%
(FPCore (w0 M D h l d)
:precision binary64
(if (or (<= h -2e+110) (not (<= h 2e+98)))
(* w0 (sqrt (fma (* h -0.25) (* M (* (* D M) (/ (/ D d) (* d l)))) 1.0)))
(*
w0
(sqrt
(fma (/ (* (* D M) -0.5) d) (/ (* (* h D) (* M 0.5)) (* l d)) 1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h <= -2e+110) || !(h <= 2e+98)) {
tmp = w0 * sqrt(fma((h * -0.25), (M * ((D * M) * ((D / d) / (d * l)))), 1.0));
} else {
tmp = w0 * sqrt(fma((((D * M) * -0.5) / d), (((h * D) * (M * 0.5)) / (l * d)), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if ((h <= -2e+110) || !(h <= 2e+98)) tmp = Float64(w0 * sqrt(fma(Float64(h * -0.25), Float64(M * Float64(Float64(D * M) * Float64(Float64(D / d) / Float64(d * l)))), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(D * M) * -0.5) / d), Float64(Float64(Float64(h * D) * Float64(M * 0.5)) / Float64(l * d)), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[h, -2e+110], N[Not[LessEqual[h, 2e+98]], $MachinePrecision]], N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] * N[(M * N[(N[(D * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(N[(D * M), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(h * D), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{+110} \lor \neg \left(h \leq 2 \cdot 10^{+98}\right):\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot -0.25, M \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{D}{d}}{d \cdot \ell}\right), 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\left(D \cdot M\right) \cdot -0.5}{d}, \frac{\left(h \cdot D\right) \cdot \left(M \cdot 0.5\right)}{\ell \cdot d}, 1\right)}\\
\end{array}
\end{array}
if h < -2e110 or 2e98 < h Initial program 73.2%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
distribute-lft-inN/A
associate-*r*N/A
rgt-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites63.1%
Applied rewrites74.9%
Applied rewrites87.6%
if -2e110 < h < 2e98Initial program 84.8%
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
lower-fma.f64N/A
Applied rewrites83.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-*.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
Final simplification87.9%
(FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (* D (* M (/ 0.5 d))))) (* w0 (sqrt (fma (* h t_0) (* (/ -1.0 l) t_0) 1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M * (0.5 / d));
return w0 * sqrt(fma((h * t_0), ((-1.0 / l) * t_0), 1.0));
}
function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M * Float64(0.5 / d))) return Float64(w0 * sqrt(fma(Float64(h * t_0), Float64(Float64(-1.0 / l) * t_0), 1.0))) end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(N[(h * t$95$0), $MachinePrecision] * N[(N[(-1.0 / l), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot t\_0, \frac{-1}{\ell} \cdot t\_0, 1\right)}
\end{array}
\end{array}
Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites87.2%
lift-fma.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites88.5%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (fma (* (* (/ 0.5 d) M) D) (/ (* (* D 0.5) (* (/ M d) h)) (- l)) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt(fma((((0.5 / d) * M) * D), (((D * 0.5) * ((M / d) * h)) / -l), 1.0));
}
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(fma(Float64(Float64(Float64(0.5 / d) * M) * D), Float64(Float64(Float64(D * 0.5) * Float64(Float64(M / d) * h)) / Float64(-l)), 1.0))) end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D), $MachinePrecision] * N[(N[(N[(D * 0.5), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\right) \cdot D, \frac{\left(D \cdot 0.5\right) \cdot \left(\frac{M}{d} \cdot h\right)}{-\ell}, 1\right)}
\end{array}
Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites87.2%
(FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
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 * 1.0d0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
def code(w0, M, D, h, l, d): return w0 * 1.0
function code(w0, M, D, h, l, d) return Float64(w0 * 1.0) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * 1.0; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot 1
\end{array}
Initial program 81.3%
Taylor expanded in M around 0
Applied rewrites70.4%
herbie shell --seed 2024303
(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))))))