
(FPCore (alpha beta) :precision binary64 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0)))) (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta): t_0 = (alpha + beta) + (2.0 * 1.0) return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta) t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0)) end
function tmp = code(alpha, beta) t_0 = (alpha + beta) + (2.0 * 1.0); tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0); end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t_0}}{t_0}}{t_0 + 1}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alpha beta) :precision binary64 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0)))) (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta): t_0 = (alpha + beta) + (2.0 * 1.0) return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta) t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0)) end
function tmp = code(alpha, beta) t_0 = (alpha + beta) + (2.0 * 1.0); tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0); end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t_0}}{t_0}}{t_0 + 1}
\end{array}
\end{array}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (+ alpha (+ beta 3.0)))
(t_1 (+ alpha (+ beta 2.0)))
(t_2 (/ (+ 1.0 alpha) t_1)))
(if (<= beta 3e+118)
(* t_2 (/ (+ 1.0 beta) (* t_0 t_1)))
(* t_2 (/ (- 1.0 (/ (+ 1.0 alpha) beta)) t_0)))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = alpha + (beta + 3.0);
double t_1 = alpha + (beta + 2.0);
double t_2 = (1.0 + alpha) / t_1;
double tmp;
if (beta <= 3e+118) {
tmp = t_2 * ((1.0 + beta) / (t_0 * t_1));
} else {
tmp = t_2 * ((1.0 - ((1.0 + alpha) / beta)) / t_0);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = alpha + (beta + 3.0d0)
t_1 = alpha + (beta + 2.0d0)
t_2 = (1.0d0 + alpha) / t_1
if (beta <= 3d+118) then
tmp = t_2 * ((1.0d0 + beta) / (t_0 * t_1))
else
tmp = t_2 * ((1.0d0 - ((1.0d0 + alpha) / beta)) / t_0)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double t_0 = alpha + (beta + 3.0);
double t_1 = alpha + (beta + 2.0);
double t_2 = (1.0 + alpha) / t_1;
double tmp;
if (beta <= 3e+118) {
tmp = t_2 * ((1.0 + beta) / (t_0 * t_1));
} else {
tmp = t_2 * ((1.0 - ((1.0 + alpha) / beta)) / t_0);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): t_0 = alpha + (beta + 3.0) t_1 = alpha + (beta + 2.0) t_2 = (1.0 + alpha) / t_1 tmp = 0 if beta <= 3e+118: tmp = t_2 * ((1.0 + beta) / (t_0 * t_1)) else: tmp = t_2 * ((1.0 - ((1.0 + alpha) / beta)) / t_0) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(alpha + Float64(beta + 3.0)) t_1 = Float64(alpha + Float64(beta + 2.0)) t_2 = Float64(Float64(1.0 + alpha) / t_1) tmp = 0.0 if (beta <= 3e+118) tmp = Float64(t_2 * Float64(Float64(1.0 + beta) / Float64(t_0 * t_1))); else tmp = Float64(t_2 * Float64(Float64(1.0 - Float64(Float64(1.0 + alpha) / beta)) / t_0)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
t_0 = alpha + (beta + 3.0);
t_1 = alpha + (beta + 2.0);
t_2 = (1.0 + alpha) / t_1;
tmp = 0.0;
if (beta <= 3e+118)
tmp = t_2 * ((1.0 + beta) / (t_0 * t_1));
else
tmp = t_2 * ((1.0 - ((1.0 + alpha) / beta)) / t_0);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(alpha + N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(alpha + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 + alpha), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[beta, 3e+118], N[(t$95$2 * N[(N[(1.0 + beta), $MachinePrecision] / N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[(1.0 - N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \alpha + \left(\beta + 3\right)\\
t_1 := \alpha + \left(\beta + 2\right)\\
t_2 := \frac{1 + \alpha}{t_1}\\
\mathbf{if}\;\beta \leq 3 \cdot 10^{+118}:\\
\;\;\;\;t_2 \cdot \frac{1 + \beta}{t_0 \cdot t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \frac{1 - \frac{1 + \alpha}{\beta}}{t_0}\\
\end{array}
\end{array}
if beta < 3e118Initial program 98.8%
Simplified99.1%
if 3e118 < beta Initial program 78.7%
Simplified82.2%
associate-*r/82.2%
+-commutative82.2%
Applied egg-rr82.2%
associate-*r/82.2%
*-commutative82.2%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in beta around inf 92.4%
mul-1-neg92.4%
unsub-neg92.4%
Simplified92.4%
Final simplification97.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= alpha 1.65e-10)
(*
(/ (+ 1.0 beta) (+ beta 2.0))
(/ (/ 1.0 (+ beta (+ alpha 2.0))) (+ beta 3.0)))
(*
(/ (+ 1.0 alpha) (+ alpha (+ beta 2.0)))
(/ (- 1.0 (/ (+ 1.0 alpha) beta)) (+ alpha (+ beta 3.0))))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / (alpha + (beta + 2.0))) * ((1.0 - ((1.0 + alpha) / beta)) / (alpha + (beta + 3.0)));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (alpha <= 1.65d-10) then
tmp = ((1.0d0 + beta) / (beta + 2.0d0)) * ((1.0d0 / (beta + (alpha + 2.0d0))) / (beta + 3.0d0))
else
tmp = ((1.0d0 + alpha) / (alpha + (beta + 2.0d0))) * ((1.0d0 - ((1.0d0 + alpha) / beta)) / (alpha + (beta + 3.0d0)))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / (alpha + (beta + 2.0))) * ((1.0 - ((1.0 + alpha) / beta)) / (alpha + (beta + 3.0)));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if alpha <= 1.65e-10: tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0)) else: tmp = ((1.0 + alpha) / (alpha + (beta + 2.0))) * ((1.0 - ((1.0 + alpha) / beta)) / (alpha + (beta + 3.0))) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (alpha <= 1.65e-10) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(beta + 2.0)) * Float64(Float64(1.0 / Float64(beta + Float64(alpha + 2.0))) / Float64(beta + 3.0))); else tmp = Float64(Float64(Float64(1.0 + alpha) / Float64(alpha + Float64(beta + 2.0))) * Float64(Float64(1.0 - Float64(Float64(1.0 + alpha) / beta)) / Float64(alpha + Float64(beta + 3.0)))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (alpha <= 1.65e-10)
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
else
tmp = ((1.0 + alpha) / (alpha + (beta + 2.0))) * ((1.0 - ((1.0 + alpha) / beta)) / (alpha + (beta + 3.0)));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[alpha, 1.65e-10], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / N[(alpha + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision] / N[(alpha + N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\alpha \leq 1.65 \cdot 10^{-10}:\\
\;\;\;\;\frac{1 + \beta}{\beta + 2} \cdot \frac{\frac{1}{\beta + \left(\alpha + 2\right)}}{\beta + 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \alpha}{\alpha + \left(\beta + 2\right)} \cdot \frac{1 - \frac{1 + \alpha}{\beta}}{\alpha + \left(\beta + 3\right)}\\
\end{array}
\end{array}
if alpha < 1.65e-10Initial program 99.9%
Simplified99.4%
associate-*r/99.5%
+-commutative99.5%
Applied egg-rr99.5%
associate-*r/99.4%
*-commutative99.4%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
expm1-log1p-u99.9%
expm1-udef89.2%
Applied egg-rr89.2%
expm1-def99.5%
expm1-log1p99.5%
associate-/r*99.9%
associate-*r/99.9%
associate-/l*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in alpha around 0 98.7%
div-inv98.6%
times-frac99.1%
+-commutative99.1%
+-commutative99.1%
+-commutative99.1%
Applied egg-rr99.1%
if 1.65e-10 < alpha Initial program 85.8%
Simplified89.2%
associate-*r/89.2%
+-commutative89.2%
Applied egg-rr89.2%
associate-*r/89.2%
*-commutative89.2%
associate-/r*99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in beta around inf 21.6%
mul-1-neg21.6%
unsub-neg21.6%
Simplified21.6%
Final simplification71.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (let* ((t_0 (+ alpha (+ beta 2.0)))) (* (/ (/ (+ 1.0 beta) t_0) (+ alpha (+ beta 3.0))) (/ (+ 1.0 alpha) t_0))))
assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = alpha + (beta + 2.0);
return (((1.0 + beta) / t_0) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / t_0);
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
t_0 = alpha + (beta + 2.0d0)
code = (((1.0d0 + beta) / t_0) / (alpha + (beta + 3.0d0))) * ((1.0d0 + alpha) / t_0)
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double t_0 = alpha + (beta + 2.0);
return (((1.0 + beta) / t_0) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / t_0);
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): t_0 = alpha + (beta + 2.0) return (((1.0 + beta) / t_0) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / t_0)
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(alpha + Float64(beta + 2.0)) return Float64(Float64(Float64(Float64(1.0 + beta) / t_0) / Float64(alpha + Float64(beta + 3.0))) * Float64(Float64(1.0 + alpha) / t_0)) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
t_0 = alpha + (beta + 2.0);
tmp = (((1.0 + beta) / t_0) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / t_0);
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(alpha + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(1.0 + beta), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(alpha + N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + alpha), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \alpha + \left(\beta + 2\right)\\
\frac{\frac{1 + \beta}{t_0}}{\alpha + \left(\beta + 3\right)} \cdot \frac{1 + \alpha}{t_0}
\end{array}
\end{array}
Initial program 94.8%
Simplified95.8%
associate-*r/95.8%
+-commutative95.8%
Applied egg-rr95.8%
associate-*r/95.8%
*-commutative95.8%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= alpha 1.65e-10)
(*
(/ (+ 1.0 beta) (+ beta 2.0))
(/ (/ 1.0 (+ beta (+ alpha 2.0))) (+ beta 3.0)))
(*
(/ (/ (+ 1.0 beta) (+ alpha (+ beta 2.0))) (+ alpha (+ beta 3.0)))
(/ (+ 1.0 alpha) beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
} else {
tmp = (((1.0 + beta) / (alpha + (beta + 2.0))) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (alpha <= 1.65d-10) then
tmp = ((1.0d0 + beta) / (beta + 2.0d0)) * ((1.0d0 / (beta + (alpha + 2.0d0))) / (beta + 3.0d0))
else
tmp = (((1.0d0 + beta) / (alpha + (beta + 2.0d0))) / (alpha + (beta + 3.0d0))) * ((1.0d0 + alpha) / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
} else {
tmp = (((1.0 + beta) / (alpha + (beta + 2.0))) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if alpha <= 1.65e-10: tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0)) else: tmp = (((1.0 + beta) / (alpha + (beta + 2.0))) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (alpha <= 1.65e-10) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(beta + 2.0)) * Float64(Float64(1.0 / Float64(beta + Float64(alpha + 2.0))) / Float64(beta + 3.0))); else tmp = Float64(Float64(Float64(Float64(1.0 + beta) / Float64(alpha + Float64(beta + 2.0))) / Float64(alpha + Float64(beta + 3.0))) * Float64(Float64(1.0 + alpha) / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (alpha <= 1.65e-10)
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / (beta + (alpha + 2.0))) / (beta + 3.0));
else
tmp = (((1.0 + beta) / (alpha + (beta + 2.0))) / (alpha + (beta + 3.0))) * ((1.0 + alpha) / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[alpha, 1.65e-10], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(alpha + N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(alpha + N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\alpha \leq 1.65 \cdot 10^{-10}:\\
\;\;\;\;\frac{1 + \beta}{\beta + 2} \cdot \frac{\frac{1}{\beta + \left(\alpha + 2\right)}}{\beta + 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \beta}{\alpha + \left(\beta + 2\right)}}{\alpha + \left(\beta + 3\right)} \cdot \frac{1 + \alpha}{\beta}\\
\end{array}
\end{array}
if alpha < 1.65e-10Initial program 99.9%
Simplified99.4%
associate-*r/99.5%
+-commutative99.5%
Applied egg-rr99.5%
associate-*r/99.4%
*-commutative99.4%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
expm1-log1p-u99.9%
expm1-udef89.2%
Applied egg-rr89.2%
expm1-def99.5%
expm1-log1p99.5%
associate-/r*99.9%
associate-*r/99.9%
associate-/l*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in alpha around 0 98.7%
div-inv98.6%
times-frac99.1%
+-commutative99.1%
+-commutative99.1%
+-commutative99.1%
Applied egg-rr99.1%
if 1.65e-10 < alpha Initial program 85.8%
Simplified89.2%
associate-*r/89.2%
+-commutative89.2%
Applied egg-rr89.2%
associate-*r/89.2%
*-commutative89.2%
associate-/r*99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in beta around inf 27.6%
Final simplification73.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (+ beta (+ alpha 2.0))))
(if (<= alpha 1.65e-10)
(* (/ (+ 1.0 beta) (+ beta 2.0)) (/ (/ 1.0 t_0) (+ beta 3.0)))
(* (/ 1.0 (/ t_0 (+ 1.0 alpha))) (/ 1.0 beta)))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = beta + (alpha + 2.0);
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / t_0) / (beta + 3.0));
} else {
tmp = (1.0 / (t_0 / (1.0 + alpha))) * (1.0 / beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: tmp
t_0 = beta + (alpha + 2.0d0)
if (alpha <= 1.65d-10) then
tmp = ((1.0d0 + beta) / (beta + 2.0d0)) * ((1.0d0 / t_0) / (beta + 3.0d0))
else
tmp = (1.0d0 / (t_0 / (1.0d0 + alpha))) * (1.0d0 / beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double t_0 = beta + (alpha + 2.0);
double tmp;
if (alpha <= 1.65e-10) {
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / t_0) / (beta + 3.0));
} else {
tmp = (1.0 / (t_0 / (1.0 + alpha))) * (1.0 / beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): t_0 = beta + (alpha + 2.0) tmp = 0 if alpha <= 1.65e-10: tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / t_0) / (beta + 3.0)) else: tmp = (1.0 / (t_0 / (1.0 + alpha))) * (1.0 / beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(beta + Float64(alpha + 2.0)) tmp = 0.0 if (alpha <= 1.65e-10) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(beta + 2.0)) * Float64(Float64(1.0 / t_0) / Float64(beta + 3.0))); else tmp = Float64(Float64(1.0 / Float64(t_0 / Float64(1.0 + alpha))) * Float64(1.0 / beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
t_0 = beta + (alpha + 2.0);
tmp = 0.0;
if (alpha <= 1.65e-10)
tmp = ((1.0 + beta) / (beta + 2.0)) * ((1.0 / t_0) / (beta + 3.0));
else
tmp = (1.0 / (t_0 / (1.0 + alpha))) * (1.0 / beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[alpha, 1.65e-10], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / t$95$0), $MachinePrecision] / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$0 / N[(1.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \beta + \left(\alpha + 2\right)\\
\mathbf{if}\;\alpha \leq 1.65 \cdot 10^{-10}:\\
\;\;\;\;\frac{1 + \beta}{\beta + 2} \cdot \frac{\frac{1}{t_0}}{\beta + 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t_0}{1 + \alpha}} \cdot \frac{1}{\beta}\\
\end{array}
\end{array}
if alpha < 1.65e-10Initial program 99.9%
Simplified99.4%
associate-*r/99.5%
+-commutative99.5%
Applied egg-rr99.5%
associate-*r/99.4%
*-commutative99.4%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
expm1-log1p-u99.9%
expm1-udef89.2%
Applied egg-rr89.2%
expm1-def99.5%
expm1-log1p99.5%
associate-/r*99.9%
associate-*r/99.9%
associate-/l*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in alpha around 0 98.7%
div-inv98.6%
times-frac99.1%
+-commutative99.1%
+-commutative99.1%
+-commutative99.1%
Applied egg-rr99.1%
if 1.65e-10 < alpha Initial program 85.8%
Simplified89.2%
Taylor expanded in beta around inf 21.8%
clear-num21.8%
inv-pow21.8%
+-commutative21.8%
Applied egg-rr21.8%
unpow-121.8%
+-commutative21.8%
associate-+r+21.8%
+-commutative21.8%
Simplified21.8%
Final simplification71.3%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (+ beta (+ alpha 2.0))))
(if (<= beta 9e+15)
(/ (/ (+ 1.0 beta) t_0) (* (+ beta 2.0) (+ beta 3.0)))
(/ (/ (+ 1.0 alpha) t_0) beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = beta + (alpha + 2.0);
double tmp;
if (beta <= 9e+15) {
tmp = ((1.0 + beta) / t_0) / ((beta + 2.0) * (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / t_0) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: tmp
t_0 = beta + (alpha + 2.0d0)
if (beta <= 9d+15) then
tmp = ((1.0d0 + beta) / t_0) / ((beta + 2.0d0) * (beta + 3.0d0))
else
tmp = ((1.0d0 + alpha) / t_0) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double t_0 = beta + (alpha + 2.0);
double tmp;
if (beta <= 9e+15) {
tmp = ((1.0 + beta) / t_0) / ((beta + 2.0) * (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / t_0) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): t_0 = beta + (alpha + 2.0) tmp = 0 if beta <= 9e+15: tmp = ((1.0 + beta) / t_0) / ((beta + 2.0) * (beta + 3.0)) else: tmp = ((1.0 + alpha) / t_0) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(beta + Float64(alpha + 2.0)) tmp = 0.0 if (beta <= 9e+15) tmp = Float64(Float64(Float64(1.0 + beta) / t_0) / Float64(Float64(beta + 2.0) * Float64(beta + 3.0))); else tmp = Float64(Float64(Float64(1.0 + alpha) / t_0) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
t_0 = beta + (alpha + 2.0);
tmp = 0.0;
if (beta <= 9e+15)
tmp = ((1.0 + beta) / t_0) / ((beta + 2.0) * (beta + 3.0));
else
tmp = ((1.0 + alpha) / t_0) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[beta, 9e+15], N[(N[(N[(1.0 + beta), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(N[(beta + 2.0), $MachinePrecision] * N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / t$95$0), $MachinePrecision] / beta), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \beta + \left(\alpha + 2\right)\\
\mathbf{if}\;\beta \leq 9 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{1 + \beta}{t_0}}{\left(\beta + 2\right) \cdot \left(\beta + 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{t_0}}{\beta}\\
\end{array}
\end{array}
if beta < 9e15Initial program 99.3%
Simplified99.4%
associate-*r/99.4%
+-commutative99.4%
Applied egg-rr99.4%
associate-*r/99.4%
*-commutative99.4%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
expm1-log1p-u99.8%
expm1-udef80.9%
Applied egg-rr80.9%
expm1-def99.4%
expm1-log1p99.4%
associate-/r*99.8%
associate-*r/99.8%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in alpha around 0 67.5%
if 9e15 < beta Initial program 81.4%
Simplified84.8%
Taylor expanded in beta around inf 90.8%
un-div-inv90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
Applied egg-rr90.9%
Final simplification73.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 3.9e+15) (/ (/ (+ 1.0 beta) (+ beta 2.0)) (* (+ beta 2.0) (+ beta 3.0))) (/ (/ (+ 1.0 alpha) (+ beta (+ alpha 2.0))) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.9e+15) {
tmp = ((1.0 + beta) / (beta + 2.0)) / ((beta + 2.0) * (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.9d+15) then
tmp = ((1.0d0 + beta) / (beta + 2.0d0)) / ((beta + 2.0d0) * (beta + 3.0d0))
else
tmp = ((1.0d0 + alpha) / (beta + (alpha + 2.0d0))) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.9e+15) {
tmp = ((1.0 + beta) / (beta + 2.0)) / ((beta + 2.0) * (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.9e+15: tmp = ((1.0 + beta) / (beta + 2.0)) / ((beta + 2.0) * (beta + 3.0)) else: tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.9e+15) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(beta + 2.0)) / Float64(Float64(beta + 2.0) * Float64(beta + 3.0))); else tmp = Float64(Float64(Float64(1.0 + alpha) / Float64(beta + Float64(alpha + 2.0))) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.9e+15)
tmp = ((1.0 + beta) / (beta + 2.0)) / ((beta + 2.0) * (beta + 3.0));
else
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.9e+15], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] / N[(N[(beta + 2.0), $MachinePrecision] * N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.9 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{1 + \beta}{\beta + 2}}{\left(\beta + 2\right) \cdot \left(\beta + 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta + \left(\alpha + 2\right)}}{\beta}\\
\end{array}
\end{array}
if beta < 3.9e15Initial program 99.3%
associate-/l/98.9%
+-commutative98.9%
+-commutative98.9%
associate-+r+98.9%
*-commutative98.9%
metadata-eval98.9%
associate-+l+98.9%
metadata-eval98.9%
associate-+l+98.9%
metadata-eval98.9%
metadata-eval98.9%
associate-+l+98.9%
Simplified98.9%
Taylor expanded in alpha around 0 84.6%
Taylor expanded in alpha around 0 66.2%
if 3.9e15 < beta Initial program 81.4%
Simplified84.8%
Taylor expanded in beta around inf 90.8%
un-div-inv90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
Applied egg-rr90.9%
Final simplification72.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.5) (+ 0.08333333333333333 (* beta -0.027777777777777776)) (/ (/ (+ 1.0 alpha) (+ beta (+ alpha 2.0))) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.5d0) then
tmp = 0.08333333333333333d0 + (beta * (-0.027777777777777776d0))
else
tmp = ((1.0d0 + alpha) / (beta + (alpha + 2.0d0))) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.5: tmp = 0.08333333333333333 + (beta * -0.027777777777777776) else: tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.5) tmp = Float64(0.08333333333333333 + Float64(beta * -0.027777777777777776)); else tmp = Float64(Float64(Float64(1.0 + alpha) / Float64(beta + Float64(alpha + 2.0))) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.5)
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
else
tmp = ((1.0 + alpha) / (beta + (alpha + 2.0))) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.5], N[(0.08333333333333333 + N[(beta * -0.027777777777777776), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta + N[(alpha + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.5:\\
\;\;\;\;0.08333333333333333 + \beta \cdot -0.027777777777777776\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta + \left(\alpha + 2\right)}}{\beta}\\
\end{array}
\end{array}
if beta < 2.5Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.8%
*-commutative65.8%
Simplified65.8%
if 2.5 < beta Initial program 81.3%
Simplified85.9%
Taylor expanded in beta around inf 87.4%
un-div-inv87.5%
+-commutative87.5%
+-commutative87.5%
associate-+r+87.5%
Applied egg-rr87.5%
Final simplification71.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.5) (+ 0.08333333333333333 (* beta -0.027777777777777776)) (/ 1.0 (* beta (+ beta 2.0)))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = 1.0 / (beta * (beta + 2.0));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.5d0) then
tmp = 0.08333333333333333d0 + (beta * (-0.027777777777777776d0))
else
tmp = 1.0d0 / (beta * (beta + 2.0d0))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = 1.0 / (beta * (beta + 2.0));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.5: tmp = 0.08333333333333333 + (beta * -0.027777777777777776) else: tmp = 1.0 / (beta * (beta + 2.0)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.5) tmp = Float64(0.08333333333333333 + Float64(beta * -0.027777777777777776)); else tmp = Float64(1.0 / Float64(beta * Float64(beta + 2.0))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.5)
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
else
tmp = 1.0 / (beta * (beta + 2.0));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.5], N[(0.08333333333333333 + N[(beta * -0.027777777777777776), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(beta * N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.5:\\
\;\;\;\;0.08333333333333333 + \beta \cdot -0.027777777777777776\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\beta \cdot \left(\beta + 2\right)}\\
\end{array}
\end{array}
if beta < 2.5Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.8%
*-commutative65.8%
Simplified65.8%
if 2.5 < beta Initial program 81.3%
Simplified85.9%
Taylor expanded in beta around inf 87.4%
Taylor expanded in alpha around 0 75.2%
Final simplification68.3%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.5) (+ 0.08333333333333333 (* beta -0.027777777777777776)) (/ (/ 1.0 (+ beta 2.0)) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = (1.0 / (beta + 2.0)) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.5d0) then
tmp = 0.08333333333333333d0 + (beta * (-0.027777777777777776d0))
else
tmp = (1.0d0 / (beta + 2.0d0)) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = (1.0 / (beta + 2.0)) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.5: tmp = 0.08333333333333333 + (beta * -0.027777777777777776) else: tmp = (1.0 / (beta + 2.0)) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.5) tmp = Float64(0.08333333333333333 + Float64(beta * -0.027777777777777776)); else tmp = Float64(Float64(1.0 / Float64(beta + 2.0)) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.5)
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
else
tmp = (1.0 / (beta + 2.0)) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.5], N[(0.08333333333333333 + N[(beta * -0.027777777777777776), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(beta + 2.0), $MachinePrecision]), $MachinePrecision] / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.5:\\
\;\;\;\;0.08333333333333333 + \beta \cdot -0.027777777777777776\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\beta + 2}}{\beta}\\
\end{array}
\end{array}
if beta < 2.5Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.8%
*-commutative65.8%
Simplified65.8%
if 2.5 < beta Initial program 81.3%
Simplified85.9%
Taylor expanded in beta around inf 87.4%
un-div-inv87.5%
+-commutative87.5%
+-commutative87.5%
associate-+r+87.5%
Applied egg-rr87.5%
Taylor expanded in alpha around 0 76.3%
Final simplification68.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.8) (+ 0.08333333333333333 (* beta -0.027777777777777776)) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.8) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.8d0) then
tmp = 0.08333333333333333d0 + (beta * (-0.027777777777777776d0))
else
tmp = ((1.0d0 + alpha) / beta) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.8) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.8: tmp = 0.08333333333333333 + (beta * -0.027777777777777776) else: tmp = ((1.0 + alpha) / beta) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.8) tmp = Float64(0.08333333333333333 + Float64(beta * -0.027777777777777776)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.8)
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
else
tmp = ((1.0 + alpha) / beta) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.8], N[(0.08333333333333333 + N[(beta * -0.027777777777777776), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.8:\\
\;\;\;\;0.08333333333333333 + \beta \cdot -0.027777777777777776\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 2.7999999999999998Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.8%
*-commutative65.8%
Simplified65.8%
if 2.7999999999999998 < beta Initial program 81.3%
Simplified85.9%
Taylor expanded in beta around inf 87.4%
un-div-inv87.5%
+-commutative87.5%
+-commutative87.5%
associate-+r+87.5%
Applied egg-rr87.5%
Taylor expanded in beta around inf 87.3%
Final simplification71.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.5) (+ 0.08333333333333333 (* beta -0.027777777777777776)) (/ 0.2 beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = 0.2 / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.5d0) then
tmp = 0.08333333333333333d0 + (beta * (-0.027777777777777776d0))
else
tmp = 0.2d0 / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.5) {
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
} else {
tmp = 0.2 / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.5: tmp = 0.08333333333333333 + (beta * -0.027777777777777776) else: tmp = 0.2 / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.5) tmp = Float64(0.08333333333333333 + Float64(beta * -0.027777777777777776)); else tmp = Float64(0.2 / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.5)
tmp = 0.08333333333333333 + (beta * -0.027777777777777776);
else
tmp = 0.2 / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.5], N[(0.08333333333333333 + N[(beta * -0.027777777777777776), $MachinePrecision]), $MachinePrecision], N[(0.2 / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.5:\\
\;\;\;\;0.08333333333333333 + \beta \cdot -0.027777777777777776\\
\mathbf{else}:\\
\;\;\;\;\frac{0.2}{\beta}\\
\end{array}
\end{array}
if beta < 2.5Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.8%
*-commutative65.8%
Simplified65.8%
if 2.5 < beta Initial program 81.3%
Simplified69.2%
Taylor expanded in beta around 0 50.8%
Taylor expanded in alpha around 0 58.7%
Taylor expanded in beta around inf 7.3%
Final simplification50.0%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.4) 0.08333333333333333 (/ 0.2 beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.4) {
tmp = 0.08333333333333333;
} else {
tmp = 0.2 / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.4d0) then
tmp = 0.08333333333333333d0
else
tmp = 0.2d0 / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.4) {
tmp = 0.08333333333333333;
} else {
tmp = 0.2 / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.4: tmp = 0.08333333333333333 else: tmp = 0.2 / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.4) tmp = 0.08333333333333333; else tmp = Float64(0.2 / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.4)
tmp = 0.08333333333333333;
else
tmp = 0.2 / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.4], 0.08333333333333333, N[(0.2 / beta), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.4:\\
\;\;\;\;0.08333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{0.2}{\beta}\\
\end{array}
\end{array}
if beta < 2.39999999999999991Initial program 99.8%
Simplified92.7%
Taylor expanded in beta around 0 92.1%
Taylor expanded in alpha around 0 65.8%
Taylor expanded in beta around 0 65.1%
if 2.39999999999999991 < beta Initial program 81.3%
Simplified69.2%
Taylor expanded in beta around 0 50.8%
Taylor expanded in alpha around 0 58.7%
Taylor expanded in beta around inf 7.3%
Final simplification49.5%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 0.08333333333333333)
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.08333333333333333;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
real(8) function code(alpha, beta)
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = 0.08333333333333333d0
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.08333333333333333;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.08333333333333333
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return 0.08333333333333333 end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.08333333333333333;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := 0.08333333333333333
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
0.08333333333333333
\end{array}
Initial program 94.8%
Simplified86.4%
Taylor expanded in beta around 0 81.0%
Taylor expanded in alpha around 0 63.8%
Taylor expanded in beta around 0 48.6%
Final simplification48.6%
herbie shell --seed 2023334
(FPCore (alpha beta)
:name "Octave 3.8, jcobi/3"
:precision binary64
:pre (and (> alpha -1.0) (> beta -1.0))
(/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0)))