
(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 10 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: M 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-12) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (* D 0.5) (/ d M)) 2.0))))) w0))
assert(M < 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-12) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D * 0.5) / (d / M)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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-12) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d * 0.5d0) / (d_1 / m)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
assert M < 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-12) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D * 0.5) / (d / M)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= 2e-12: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D * 0.5) / (d / M)), 2.0)))) else: tmp = w0 return tmp
M, D = sort([M, 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-12) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D * 0.5) / Float64(d / M)) ^ 2.0))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, 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-12)
tmp = w0 * sqrt((1.0 - ((h / l) * (((D * 0.5) / (d / M)) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M 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-12], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D \cdot 0.5}{\frac{d}{M}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 1.99999999999999996e-12Initial program 89.8%
*-commutative89.8%
times-frac89.3%
Simplified89.3%
*-commutative89.3%
clear-num89.4%
un-div-inv89.7%
div-inv89.7%
metadata-eval89.7%
Applied egg-rr89.7%
if 1.99999999999999996e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 0.0%
*-commutative0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in M around 0 65.3%
Final simplification87.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ h l) (- INFINITY))
(* w0 (sqrt (+ 1.0 (/ (* -0.25 (* D D)) (/ (/ (* d (* l d)) h) (* M M))))))
(if (<= (/ h l) -1e-321)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
w0)))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 * sqrt((1.0 + ((-0.25 * (D * D)) / (((d * (l * d)) / h) / (M * M)))));
} else if ((h / l) <= -1e-321) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 + ((-0.25 * (D * D)) / (((d * (l * d)) / h) / (M * M)))));
} else if ((h / l) <= -1e-321) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -math.inf: tmp = w0 * math.sqrt((1.0 + ((-0.25 * (D * D)) / (((d * (l * d)) / h) / (M * M))))) elif (h / l) <= -1e-321: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(-0.25 * Float64(D * D)) / Float64(Float64(Float64(d * Float64(l * d)) / h) / Float64(M * M)))))); elseif (Float64(h / l) <= -1e-321) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -Inf)
tmp = w0 * sqrt((1.0 + ((-0.25 * (D * D)) / (((d * (l * d)) / h) / (M * M)))));
elseif ((h / l) <= -1e-321)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(-0.25 * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-321], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{d \cdot \left(\ell \cdot d\right)}{h}}{M \cdot M}}}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-321}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 39.3%
*-commutative39.3%
times-frac39.3%
Simplified39.3%
Taylor expanded in w0 around 0 52.6%
*-commutative52.6%
cancel-sign-sub-inv52.6%
metadata-eval52.6%
*-commutative52.6%
associate-/l*52.6%
associate-*r/52.6%
unpow252.6%
associate-/r*53.2%
*-commutative53.2%
unpow253.2%
associate-*l*65.2%
unpow265.2%
Simplified65.2%
if -inf.0 < (/.f64 h l) < -9.98013e-322Initial program 85.5%
*-commutative85.5%
times-frac84.7%
Simplified84.7%
if -9.98013e-322 < (/.f64 h l) Initial program 87.9%
*-commutative87.9%
times-frac87.9%
Simplified87.9%
Taylor expanded in M around 0 95.1%
Final simplification86.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (+ 1.0 (/ -1.0 (* l (/ 1.0 (* h (pow (* (/ M d) (* D 0.5)) 2.0)))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-1.0 / (l * (1.0 / (h * pow(((M / d) * (D * 0.5)), 2.0)))))));
}
NOTE: M 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 * sqrt((1.0d0 + ((-1.0d0) / (l * (1.0d0 / (h * (((m / d_1) * (d * 0.5d0)) ** 2.0d0)))))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-1.0 / (l * (1.0 / (h * Math.pow(((M / d) * (D * 0.5)), 2.0)))))));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-1.0 / (l * (1.0 / (h * math.pow(((M / d) * (D * 0.5)), 2.0)))))))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l * Float64(1.0 / Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0)))))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 + (-1.0 / (l * (1.0 / (h * (((M / d) * (D * 0.5)) ^ 2.0)))))));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l * N[(1.0 / N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + \frac{-1}{\ell \cdot \frac{1}{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}}}
\end{array}
Initial program 81.7%
*-commutative81.7%
times-frac81.3%
Simplified81.3%
associate-*r/86.8%
frac-times87.2%
*-commutative87.2%
clear-num87.2%
*-commutative87.2%
*-commutative87.2%
frac-times86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
div-inv86.8%
Applied egg-rr86.8%
Final simplification86.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (+ 1.0 (/ -1.0 (/ l (* h (pow (* (/ M d) (* D 0.5)) 2.0))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-1.0 / (l / (h * pow(((M / d) * (D * 0.5)), 2.0))))));
}
NOTE: M 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 * sqrt((1.0d0 + ((-1.0d0) / (l / (h * (((m / d_1) * (d * 0.5d0)) ** 2.0d0))))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-1.0 / (l / (h * Math.pow(((M / d) * (D * 0.5)), 2.0))))));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-1.0 / (l / (h * math.pow(((M / d) * (D * 0.5)), 2.0))))))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l / Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0))))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 + (-1.0 / (l / (h * (((M / d) * (D * 0.5)) ^ 2.0))))));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l / N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + \frac{-1}{\frac{\ell}{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}}}
\end{array}
Initial program 81.7%
*-commutative81.7%
times-frac81.3%
Simplified81.3%
associate-*r/86.8%
frac-times87.2%
*-commutative87.2%
clear-num87.2%
*-commutative87.2%
*-commutative87.2%
frac-times86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
Final simplification86.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* (/ M d) (* D 0.5)) 2.0)) l)))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow(((M / d) * (D * 0.5)), 2.0)) / l)));
}
NOTE: M 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 * sqrt((1.0d0 - ((h * (((m / d_1) * (d * 0.5d0)) ** 2.0d0)) / l)))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow(((M / d) * (D * 0.5)), 2.0)) / l)));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow(((M / d) * (D * 0.5)), 2.0)) / l)))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0)) / l)))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * (((M / d) * (D * 0.5)) ^ 2.0)) / l)));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 81.7%
*-commutative81.7%
times-frac81.3%
Simplified81.3%
*-commutative81.3%
frac-times81.7%
*-commutative81.7%
associate-*l/87.2%
*-commutative87.2%
frac-times86.8%
div-inv86.8%
metadata-eval86.8%
Applied egg-rr86.8%
Final simplification86.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (/ h l) -1e-223) (* w0 (sqrt (- 1.0 (* (/ 0.25 l) (* (* M M) (* (/ (* h D) d) (/ D d))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-223) {
tmp = w0 * sqrt((1.0 - ((0.25 / l) * ((M * M) * (((h * D) / d) * (D / d))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((h / l) <= (-1d-223)) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 / l) * ((m * m) * (((h * d) / d_1) * (d / d_1))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-223) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 / l) * ((M * M) * (((h * D) / d) * (D / d))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -1e-223: tmp = w0 * math.sqrt((1.0 - ((0.25 / l) * ((M * M) * (((h * D) / d) * (D / d)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e-223) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 / l) * Float64(Float64(M * M) * Float64(Float64(Float64(h * D) / d) * Float64(D / d))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -1e-223)
tmp = w0 * sqrt((1.0 - ((0.25 / l) * ((M * M) * (((h * D) / d) * (D / d))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-223], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 / l), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(N[(N[(h * D), $MachinePrecision] / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-223}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \left(\left(M \cdot M\right) \cdot \left(\frac{h \cdot D}{d} \cdot \frac{D}{d}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.9999999999999997e-224Initial program 77.4%
*-commutative77.4%
times-frac76.6%
Simplified76.6%
Taylor expanded in M around 0 49.2%
associate-*r/49.2%
*-commutative49.2%
times-frac52.1%
associate-*r*53.8%
unpow253.8%
associate-*l*55.2%
unpow255.2%
unpow255.2%
Simplified55.2%
Taylor expanded in D around 0 52.1%
unpow252.1%
*-commutative52.1%
unpow252.1%
associate-*l*53.8%
unpow253.8%
associate-*l*55.2%
*-commutative55.2%
*-rgt-identity55.2%
associate-*r/55.2%
associate-*l*56.4%
*-commutative56.4%
associate-*l*60.2%
*-commutative60.2%
associate-*r/60.2%
*-commutative60.2%
*-lft-identity60.2%
Simplified60.2%
associate-*r/56.4%
*-commutative56.4%
Applied egg-rr56.4%
times-frac66.8%
*-commutative66.8%
Applied egg-rr66.8%
if -9.9999999999999997e-224 < (/.f64 h l) Initial program 87.1%
*-commutative87.1%
times-frac87.0%
Simplified87.0%
Taylor expanded in M around 0 90.1%
Final simplification77.2%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (or (<= D -4.3e+52) (not (<= D 1.1e+21))) (* w0 (+ 1.0 (* -0.125 (* (* D (/ D (* d d))) (/ h (/ l (* M M))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D <= -4.3e+52) || !(D <= 1.1e+21)) {
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / (l / (M * M))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((d <= (-4.3d+52)) .or. (.not. (d <= 1.1d+21))) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / (d_1 * d_1))) * (h / (l / (m * m))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D <= -4.3e+52) || !(D <= 1.1e+21)) {
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / (l / (M * M))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (D <= -4.3e+52) or not (D <= 1.1e+21): tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / (l / (M * M)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((D <= -4.3e+52) || !(D <= 1.1e+21)) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / Float64(d * d))) * Float64(h / Float64(l / Float64(M * M))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((D <= -4.3e+52) || ~((D <= 1.1e+21)))
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / (l / (M * M))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[D, -4.3e+52], N[Not[LessEqual[D, 1.1e+21]], $MachinePrecision]], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq -4.3 \cdot 10^{+52} \lor \neg \left(D \leq 1.1 \cdot 10^{+21}\right):\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{d \cdot d}\right) \cdot \frac{h}{\frac{\ell}{M \cdot M}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if D < -4.3e52 or 1.1e21 < D Initial program 76.8%
*-commutative76.8%
times-frac77.6%
Simplified77.6%
Taylor expanded in M around 0 42.2%
associate-*r/42.2%
*-commutative42.2%
associate-*r/42.2%
*-commutative42.2%
times-frac39.5%
unpow239.5%
*-commutative39.5%
unpow239.5%
unpow239.5%
Simplified39.5%
Taylor expanded in D around 0 42.2%
unpow242.2%
times-frac42.1%
unpow242.1%
*-commutative42.1%
unpow242.1%
associate-*l/58.8%
*-commutative58.8%
associate-/l*58.8%
Simplified58.8%
if -4.3e52 < D < 1.1e21Initial program 85.3%
*-commutative85.3%
times-frac84.1%
Simplified84.1%
Taylor expanded in M around 0 82.2%
Final simplification72.2%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (or (<= D -1.58e-12) (not (<= D 5.1e+20))) (* w0 (+ 1.0 (* -0.125 (* (* D (/ D (* d d))) (/ h (/ (/ l M) M)))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D <= -1.58e-12) || !(D <= 5.1e+20)) {
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / ((l / M) / M)))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((d <= (-1.58d-12)) .or. (.not. (d <= 5.1d+20))) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / (d_1 * d_1))) * (h / ((l / m) / m)))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D <= -1.58e-12) || !(D <= 5.1e+20)) {
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / ((l / M) / M)))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (D <= -1.58e-12) or not (D <= 5.1e+20): tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / ((l / M) / M))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((D <= -1.58e-12) || !(D <= 5.1e+20)) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / Float64(d * d))) * Float64(h / Float64(Float64(l / M) / M)))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((D <= -1.58e-12) || ~((D <= 5.1e+20)))
tmp = w0 * (1.0 + (-0.125 * ((D * (D / (d * d))) * (h / ((l / M) / M)))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[D, -1.58e-12], N[Not[LessEqual[D, 5.1e+20]], $MachinePrecision]], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / N[(N[(l / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq -1.58 \cdot 10^{-12} \lor \neg \left(D \leq 5.1 \cdot 10^{+20}\right):\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{d \cdot d}\right) \cdot \frac{h}{\frac{\frac{\ell}{M}}{M}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if D < -1.57999999999999993e-12 or 5.1e20 < D Initial program 77.7%
*-commutative77.7%
times-frac78.4%
Simplified78.4%
Taylor expanded in M around 0 43.6%
associate-*r/43.6%
*-commutative43.6%
associate-*r/43.6%
*-commutative43.6%
times-frac41.2%
unpow241.2%
*-commutative41.2%
unpow241.2%
unpow241.2%
Simplified41.2%
Taylor expanded in D around 0 43.6%
unpow243.6%
times-frac43.4%
unpow243.4%
*-commutative43.4%
unpow243.4%
associate-*l/58.4%
*-commutative58.4%
associate-/l*58.4%
Simplified58.4%
Taylor expanded in l around 0 58.4%
unpow258.4%
associate-/r*61.8%
Simplified61.8%
if -1.57999999999999993e-12 < D < 5.1e20Initial program 85.3%
*-commutative85.3%
times-frac83.9%
Simplified83.9%
Taylor expanded in M around 0 83.9%
Final simplification73.4%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (/ h l) -1e+76) (* w0 (+ 1.0 (* (* (/ (* D D) l) (* (* M (/ M d)) (/ h d))) -0.125))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e+76) {
tmp = w0 * (1.0 + ((((D * D) / l) * ((M * (M / d)) * (h / d))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((h / l) <= (-1d+76)) then
tmp = w0 * (1.0d0 + ((((d * d) / l) * ((m * (m / d_1)) * (h / d_1))) * (-0.125d0)))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e+76) {
tmp = w0 * (1.0 + ((((D * D) / l) * ((M * (M / d)) * (h / d))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -1e+76: tmp = w0 * (1.0 + ((((D * D) / l) * ((M * (M / d)) * (h / d))) * -0.125)) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e+76) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D * D) / l) * Float64(Float64(M * Float64(M / d)) * Float64(h / d))) * -0.125))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -1e+76)
tmp = w0 * (1.0 + ((((D * D) / l) * ((M * (M / d)) * (h / d))) * -0.125));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e+76], N[(w0 * N[(1.0 + N[(N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{+76}:\\
\;\;\;\;w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \left(\left(M \cdot \frac{M}{d}\right) \cdot \frac{h}{d}\right)\right) \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1e76Initial program 70.0%
*-commutative70.0%
times-frac70.0%
Simplified70.0%
Taylor expanded in M around 0 50.7%
associate-*r/50.7%
*-commutative50.7%
associate-*r/50.7%
*-commutative50.7%
times-frac49.8%
unpow249.8%
*-commutative49.8%
unpow249.8%
unpow249.8%
Simplified49.8%
Taylor expanded in M around 0 49.8%
unpow249.8%
unpow249.8%
times-frac56.9%
associate-/l*62.3%
associate-/r/62.3%
Simplified62.3%
if -1e76 < (/.f64 h l) Initial program 86.6%
*-commutative86.6%
times-frac86.0%
Simplified86.0%
Taylor expanded in M around 0 79.6%
Final simplification74.5%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M 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
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 81.7%
*-commutative81.7%
times-frac81.3%
Simplified81.3%
Taylor expanded in M around 0 66.4%
Final simplification66.4%
herbie shell --seed 2023176
(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))))))