
(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 13 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}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* M D) (* d 2.0))))
(if (<= (- 1.0 (* (pow t_0 2.0) (/ h l))) 5e+293)
(* w0 (sqrt (fma t_0 (/ (/ (* M D) (* d -2.0)) (/ l h)) 1.0)))
(*
w0
(sqrt
(fma (/ (* (/ M d) (* D -0.5)) l) (* (* M 0.5) (* h (/ D d))) 1.0))))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / (d * 2.0);
double tmp;
if ((1.0 - (pow(t_0, 2.0) * (h / l))) <= 5e+293) {
tmp = w0 * sqrt(fma(t_0, (((M * D) / (d * -2.0)) / (l / h)), 1.0));
} else {
tmp = w0 * sqrt(fma((((M / d) * (D * -0.5)) / l), ((M * 0.5) * (h * (D / d))), 1.0));
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / Float64(d * 2.0)) tmp = 0.0 if (Float64(1.0 - Float64((t_0 ^ 2.0) * Float64(h / l))) <= 5e+293) tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(Float64(M * D) / Float64(d * -2.0)) / Float64(l / h)), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(M / d) * Float64(D * -0.5)) / l), Float64(Float64(M * 0.5) * Float64(h * Float64(D / d))), 1.0))); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+293], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M * 0.5), $MachinePrecision] * N[(h * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{d \cdot 2}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+293}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{\frac{M \cdot D}{d \cdot -2}}{\frac{\ell}{h}}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M}{d} \cdot \left(D \cdot -0.5\right)}{\ell}, \left(M \cdot 0.5\right) \cdot \left(h \cdot \frac{D}{d}\right), 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))) < 5.00000000000000033e293Initial program 99.9%
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
distribute-lft-neg-inN/A
Applied rewrites99.9%
if 5.00000000000000033e293 < (-.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 43.8%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites70.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r/N/A
/-rgt-identityN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval71.4
Applied rewrites71.4%
Final simplification91.5%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* M D) (* d 2.0))))
(if (<= (- 1.0 (* (pow t_0 2.0) (/ h l))) 5e+293)
(* w0 (sqrt (fma t_0 (* (/ (* M D) (* d -2.0)) (/ h l)) 1.0)))
(*
w0
(sqrt
(fma (/ (* (/ M d) (* D -0.5)) l) (* (* M 0.5) (* h (/ D d))) 1.0))))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / (d * 2.0);
double tmp;
if ((1.0 - (pow(t_0, 2.0) * (h / l))) <= 5e+293) {
tmp = w0 * sqrt(fma(t_0, (((M * D) / (d * -2.0)) * (h / l)), 1.0));
} else {
tmp = w0 * sqrt(fma((((M / d) * (D * -0.5)) / l), ((M * 0.5) * (h * (D / d))), 1.0));
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / Float64(d * 2.0)) tmp = 0.0 if (Float64(1.0 - Float64((t_0 ^ 2.0) * Float64(h / l))) <= 5e+293) tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(Float64(M * D) / Float64(d * -2.0)) * Float64(h / l)), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(M / d) * Float64(D * -0.5)) / l), Float64(Float64(M * 0.5) * Float64(h * Float64(D / d))), 1.0))); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+293], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M * 0.5), $MachinePrecision] * N[(h * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{d \cdot 2}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+293}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M}{d} \cdot \left(D \cdot -0.5\right)}{\ell}, \left(M \cdot 0.5\right) \cdot \left(h \cdot \frac{D}{d}\right), 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))) < 5.00000000000000033e293Initial program 99.9%
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
distribute-lft-neg-inN/A
Applied rewrites99.9%
if 5.00000000000000033e293 < (-.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 43.8%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites70.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r/N/A
/-rgt-identityN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval71.4
Applied rewrites71.4%
Final simplification91.5%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* M D) (* d 2.0))))
(if (<= (- 1.0 (* (pow t_0 2.0) (/ h l))) INFINITY)
(* w0 (sqrt (fma t_0 (* (/ (* M D) (* d -2.0)) (/ h l)) 1.0)))
(*
w0
(sqrt
(fma (/ (* M D) (* (* d -2.0) l)) (* h (/ (* (* M D) 0.5) d)) 1.0))))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / (d * 2.0);
double tmp;
if ((1.0 - (pow(t_0, 2.0) * (h / l))) <= ((double) INFINITY)) {
tmp = w0 * sqrt(fma(t_0, (((M * D) / (d * -2.0)) * (h / l)), 1.0));
} else {
tmp = w0 * sqrt(fma(((M * D) / ((d * -2.0) * l)), (h * (((M * D) * 0.5) / d)), 1.0));
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / Float64(d * 2.0)) tmp = 0.0 if (Float64(1.0 - Float64((t_0 ^ 2.0) * Float64(h / l))) <= Inf) tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(Float64(M * D) / Float64(d * -2.0)) * Float64(h / l)), 1.0))); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(M * D) / Float64(Float64(d * -2.0) * l)), Float64(h * Float64(Float64(Float64(M * D) * 0.5) / d)), 1.0))); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(M * D), $MachinePrecision] / N[(N[(d * -2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{d \cdot 2}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq \infty:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{\left(d \cdot -2\right) \cdot \ell}, h \cdot \frac{\left(M \cdot D\right) \cdot 0.5}{d}, 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))) < +inf.0Initial program 90.7%
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
distribute-lft-neg-inN/A
Applied rewrites91.9%
if +inf.0 < (-.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 0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites76.7%
Applied rewrites76.3%
Final simplification90.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (- 1.0 (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l))) 1.0002)
(* w0 1.0)
(*
w0
(sqrt
(fma (/ (* M D) (* (* d -2.0) l)) (* h (/ (* (* M D) 0.5) d)) 1.0)))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((1.0 - (pow(((M * D) / (d * 2.0)), 2.0) * (h / l))) <= 1.0002) {
tmp = w0 * 1.0;
} else {
tmp = w0 * sqrt(fma(((M * D) / ((d * -2.0) * l)), (h * (((M * D) * 0.5) / d)), 1.0));
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) <= 1.0002) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(M * D) / Float64(Float64(d * -2.0) * l)), Float64(h * Float64(Float64(Float64(M * D) * 0.5) / d)), 1.0))); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0002], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(M * D), $MachinePrecision] / N[(N[(d * -2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 1.0002:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{\left(d \cdot -2\right) \cdot \ell}, h \cdot \frac{\left(M \cdot D\right) \cdot 0.5}{d}, 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))) < 1.0002Initial program 100.0%
Taylor expanded in M around 0
Applied rewrites99.8%
if 1.0002 < (-.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 56.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites75.9%
Applied rewrites72.3%
Final simplification89.2%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -1e-11) (* w0 (sqrt (- 1.0 (* (/ h l) (* (* M D) (/ (* M D) (* (* d d) 4.0))))))) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -1e-11) {
tmp = w0 * sqrt((1.0 - ((h / l) * ((M * D) * ((M * D) / ((d * d) * 4.0))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-1d-11)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m * d) * ((m * d) / ((d_1 * d_1) * 4.0d0))))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -1e-11) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * ((M * D) * ((M * D) / ((d * d) * 4.0))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -1e-11: tmp = w0 * math.sqrt((1.0 - ((h / l) * ((M * D) * ((M * D) / ((d * d) * 4.0)))))) else: tmp = w0 * 1.0 return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -1e-11) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(M * D) * Float64(Float64(M * D) / Float64(Float64(d * d) * 4.0))))))); else tmp = Float64(w0 * 1.0); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= -1e-11)
tmp = w0 * sqrt((1.0 - ((h / l) * ((M * D) * ((M * D) / ((d * d) * 4.0))))));
else
tmp = w0 * 1.0;
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e-11], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{-11}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\left(M \cdot D\right) \cdot \frac{M \cdot D}{\left(d \cdot d\right) \cdot 4}\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.99999999999999939e-12Initial program 72.3%
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-eval61.8
Applied rewrites61.8%
if -9.99999999999999939e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.1%
Taylor expanded in M around 0
Applied rewrites96.5%
Final simplification85.8%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -2e+15)
(*
w0
(sqrt
(+ 1.0 (* (* M D) (* (* M D) (* h (/ -1.0 (* (* d l) (* d 4.0)))))))))
(* w0 1.0)))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -2e+15) {
tmp = w0 * sqrt((1.0 + ((M * D) * ((M * D) * (h * (-1.0 / ((d * l) * (d * 4.0))))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-2d+15)) then
tmp = w0 * sqrt((1.0d0 + ((m * d) * ((m * d) * (h * ((-1.0d0) / ((d_1 * l) * (d_1 * 4.0d0))))))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -2e+15) {
tmp = w0 * Math.sqrt((1.0 + ((M * D) * ((M * D) * (h * (-1.0 / ((d * l) * (d * 4.0))))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -2e+15: tmp = w0 * math.sqrt((1.0 + ((M * D) * ((M * D) * (h * (-1.0 / ((d * l) * (d * 4.0)))))))) else: tmp = w0 * 1.0 return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -2e+15) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(h * Float64(-1.0 / Float64(Float64(d * l) * Float64(d * 4.0))))))))); else tmp = Float64(w0 * 1.0); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= -2e+15)
tmp = w0 * sqrt((1.0 + ((M * D) * ((M * D) * (h * (-1.0 / ((d * l) * (d * 4.0))))))));
else
tmp = w0 * 1.0;
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+15], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(h * N[(-1.0 / N[(N[(d * l), $MachinePrecision] * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+15}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(h \cdot \frac{-1}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\right)}\right)\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)) < -2e15Initial program 70.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied rewrites61.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites61.9%
if -2e15 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.4%
Taylor expanded in M around 0
Applied rewrites95.2%
Final simplification85.4%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -2e+15) (* w0 (sqrt (fma (* (* M D) (- (* M D))) (/ h (* d (* 4.0 (* d l)))) 1.0))) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -2e+15) {
tmp = w0 * sqrt(fma(((M * D) * -(M * D)), (h / (d * (4.0 * (d * l)))), 1.0));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -2e+15) tmp = Float64(w0 * sqrt(fma(Float64(Float64(M * D) * Float64(-Float64(M * D))), Float64(h / Float64(d * Float64(4.0 * Float64(d * l)))), 1.0))); else tmp = Float64(w0 * 1.0); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+15], N[(w0 * N[Sqrt[N[(N[(N[(M * D), $MachinePrecision] * (-N[(M * D), $MachinePrecision])), $MachinePrecision] * N[(h / N[(d * N[(4.0 * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+15}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\left(M \cdot D\right) \cdot \left(-M \cdot D\right), \frac{h}{d \cdot \left(4 \cdot \left(d \cdot \ell\right)\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)) < -2e15Initial program 70.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied rewrites61.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites61.9%
Applied rewrites59.9%
if -2e15 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.4%
Taylor expanded in M around 0
Applied rewrites95.2%
Final simplification84.9%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -500000000.0) (* w0 (sqrt (- 1.0 (* h (/ (* M (* D (* M D))) (* (* d l) (* d 4.0))))))) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0) {
tmp = w0 * sqrt((1.0 - (h * ((M * (D * (M * D))) / ((d * l) * (d * 4.0))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-500000000.0d0)) then
tmp = w0 * sqrt((1.0d0 - (h * ((m * (d * (m * d))) / ((d_1 * l) * (d_1 * 4.0d0))))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0) {
tmp = w0 * Math.sqrt((1.0 - (h * ((M * (D * (M * D))) / ((d * l) * (d * 4.0))))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0: tmp = w0 * math.sqrt((1.0 - (h * ((M * (D * (M * D))) / ((d * l) * (d * 4.0)))))) else: tmp = w0 * 1.0 return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -500000000.0) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(M * Float64(D * Float64(M * D))) / Float64(Float64(d * l) * Float64(d * 4.0))))))); else tmp = Float64(w0 * 1.0); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= -500000000.0)
tmp = w0 * sqrt((1.0 - (h * ((M * (D * (M * D))) / ((d * l) * (d * 4.0))))));
else
tmp = w0 * 1.0;
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -500000000.0], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(M * N[(D * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(d * l), $MachinePrecision] * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -500000000:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\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)) < -5e8Initial program 71.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6471.3
Applied rewrites60.4%
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
associate-/r/N/A
lower-*.f64N/A
Applied rewrites55.4%
if -5e8 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.3%
Taylor expanded in M around 0
Applied rewrites95.6%
Final simplification83.7%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -20.0) (* w0 (sqrt (/ (* (* M (* M D)) (* D (* h -0.25))) (* d (* d l))))) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -20.0) {
tmp = w0 * sqrt((((M * (M * D)) * (D * (h * -0.25))) / (d * (d * l))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-20.0d0)) then
tmp = w0 * sqrt((((m * (m * d)) * (d * (h * (-0.25d0)))) / (d_1 * (d_1 * l))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -20.0) {
tmp = w0 * Math.sqrt((((M * (M * D)) * (D * (h * -0.25))) / (d * (d * l))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -20.0: tmp = w0 * math.sqrt((((M * (M * D)) * (D * (h * -0.25))) / (d * (d * l)))) else: tmp = w0 * 1.0 return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -20.0) tmp = Float64(w0 * sqrt(Float64(Float64(Float64(M * Float64(M * D)) * Float64(D * Float64(h * -0.25))) / Float64(d * Float64(d * l))))); else tmp = Float64(w0 * 1.0); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= -20.0)
tmp = w0 * sqrt((((M * (M * D)) * (D * (h * -0.25))) / (d * (d * l))));
else
tmp = w0 * 1.0;
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -20.0], N[(w0 * N[Sqrt[N[(N[(N[(M * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(D * N[(h * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -20:\\
\;\;\;\;w0 \cdot \sqrt{\frac{\left(M \cdot \left(M \cdot D\right)\right) \cdot \left(D \cdot \left(h \cdot -0.25\right)\right)}{d \cdot \left(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)) < -20Initial program 71.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6471.6
Applied rewrites59.6%
Taylor expanded in M 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
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6446.1
Applied rewrites46.1%
Applied rewrites49.9%
lift-sqrt.f64N/A
lift-approxN/A
lift-*.f6449.9
Applied rewrites47.8%
if -20 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.2%
Taylor expanded in M around 0
Applied rewrites96.1%
Final simplification81.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -500000000.0) (* w0 (sqrt (* (* D D) (/ (* -0.25 (* h (* M M))) (* d (* d l)))))) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0) {
tmp = w0 * sqrt(((D * D) * ((-0.25 * (h * (M * M))) / (d * (d * l)))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-500000000.0d0)) then
tmp = w0 * sqrt(((d * d) * (((-0.25d0) * (h * (m * m))) / (d_1 * (d_1 * l)))))
else
tmp = w0 * 1.0d0
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0) {
tmp = w0 * Math.sqrt(((D * D) * ((-0.25 * (h * (M * M))) / (d * (d * l)))));
} else {
tmp = w0 * 1.0;
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -500000000.0: tmp = w0 * math.sqrt(((D * D) * ((-0.25 * (h * (M * M))) / (d * (d * l))))) else: tmp = w0 * 1.0 return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -500000000.0) tmp = Float64(w0 * sqrt(Float64(Float64(D * D) * Float64(Float64(-0.25 * Float64(h * Float64(M * M))) / Float64(d * Float64(d * l)))))); else tmp = Float64(w0 * 1.0); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= -500000000.0)
tmp = w0 * sqrt(((D * D) * ((-0.25 * (h * (M * M))) / (d * (d * l)))));
else
tmp = w0 * 1.0;
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -500000000.0], N[(w0 * N[Sqrt[N[(N[(D * D), $MachinePrecision] * N[(N[(-0.25 * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -500000000:\\
\;\;\;\;w0 \cdot \sqrt{\left(D \cdot D\right) \cdot \frac{-0.25 \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot \left(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)) < -5e8Initial program 71.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6471.3
Applied rewrites60.4%
Taylor expanded in M 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
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6446.7
Applied rewrites46.7%
if -5e8 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.3%
Taylor expanded in M around 0
Applied rewrites95.6%
Final simplification81.1%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) -2e+15) (fma (* D D) (/ (* -0.125 (* h (* M (* w0 M)))) (* l (* d d))) w0) (* w0 1.0)))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= -2e+15) {
tmp = fma((D * D), ((-0.125 * (h * (M * (w0 * M)))) / (l * (d * d))), w0);
} else {
tmp = w0 * 1.0;
}
return tmp;
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -2e+15) tmp = fma(Float64(D * D), Float64(Float64(-0.125 * Float64(h * Float64(M * Float64(w0 * M)))) / Float64(l * Float64(d * d))), w0); else tmp = Float64(w0 * 1.0); end return tmp end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+15], N[(N[(D * D), $MachinePrecision] * N[(N[(-0.125 * N[(h * N[(M * N[(w0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(D \cdot D, \frac{-0.125 \cdot \left(h \cdot \left(M \cdot \left(w0 \cdot M\right)\right)\right)}{\ell \cdot \left(d \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)) < -2e15Initial program 70.9%
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.7%
if -2e15 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.4%
Taylor expanded in M around 0
Applied rewrites95.2%
Final simplification79.8%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(*
w0
(sqrt
(fma
(/ (/ (* M D) (* d -2.0)) l)
(/ (/ (* M D) (* d 2.0)) (/ 1.0 h))
1.0))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt(fma((((M * D) / (d * -2.0)) / l), (((M * D) / (d * 2.0)) / (1.0 / h)), 1.0));
}
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(fma(Float64(Float64(Float64(M * D) / Float64(d * -2.0)) / l), Float64(Float64(Float64(M * D) / Float64(d * 2.0)) / Float64(1.0 / h)), 1.0))) end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M \cdot D}{d \cdot -2}}{\ell}, \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}, 1\right)}
\end{array}
Initial program 83.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites90.7%
Final simplification90.7%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * 1.0
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * 1.0) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * 1.0;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot 1
\end{array}
Initial program 83.3%
Taylor expanded in M around 0
Applied rewrites68.9%
herbie shell --seed 2024212
(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))))))