
(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 (+ (+ beta alpha) 2.0)))
(if (<= beta 1.6e+55)
(/
1.0
(*
(* t_0 (+ alpha (+ beta 3.0)))
(/ t_0 (+ 1.0 (fma alpha beta (+ beta alpha))))))
(/ (/ (+ 1.0 alpha) beta) beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = (beta + alpha) + 2.0;
double tmp;
if (beta <= 1.6e+55) {
tmp = 1.0 / ((t_0 * (alpha + (beta + 3.0))) * (t_0 / (1.0 + fma(alpha, beta, (beta + alpha)))));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(Float64(beta + alpha) + 2.0) tmp = 0.0 if (beta <= 1.6e+55) tmp = Float64(1.0 / Float64(Float64(t_0 * Float64(alpha + Float64(beta + 3.0))) * Float64(t_0 / Float64(1.0 + fma(alpha, beta, Float64(beta + alpha)))))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.6e+55], N[(1.0 / N[(N[(t$95$0 * N[(alpha + N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(1.0 + N[(alpha * beta + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{1}{\left(t\_0 \cdot \left(\alpha + \left(\beta + 3\right)\right)\right) \cdot \frac{t\_0}{1 + \mathsf{fma}\left(\alpha, \beta, \beta + \alpha\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.6000000000000001e55Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-/.f64N/A
clear-numN/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
Applied rewrites99.8%
if 1.6000000000000001e55 < beta Initial program 81.2%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.5
Applied rewrites83.5%
Applied rewrites84.4%
Final simplification95.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 1.35e+17)
(/
(/ (+ 1.0 (fma alpha beta (+ beta alpha))) (* t_0 t_0))
(+ alpha (+ beta 3.0)))
(/ (/ (+ 1.0 alpha) beta) beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = (beta + alpha) + 2.0;
double tmp;
if (beta <= 1.35e+17) {
tmp = ((1.0 + fma(alpha, beta, (beta + alpha))) / (t_0 * t_0)) / (alpha + (beta + 3.0));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(Float64(beta + alpha) + 2.0) tmp = 0.0 if (beta <= 1.35e+17) tmp = Float64(Float64(Float64(1.0 + fma(alpha, beta, Float64(beta + alpha))) / Float64(t_0 * t_0)) / Float64(alpha + Float64(beta + 3.0))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.35e+17], N[(N[(N[(1.0 + N[(alpha * beta + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(alpha + N[(beta + 3.0), $MachinePrecision]), $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}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.35 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{1 + \mathsf{fma}\left(\alpha, \beta, \beta + \alpha\right)}{t\_0 \cdot t\_0}}{\alpha + \left(\beta + 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.35e17Initial program 99.8%
Applied rewrites99.8%
if 1.35e17 < beta Initial program 83.0%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6481.6
Applied rewrites81.6%
Applied rewrites82.3%
Final simplification94.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 1.55e+16)
(/
(/ (+ beta 1.0) (* (+ beta 2.0) (+ beta 2.0)))
(+ 1.0 (+ (+ beta alpha) 2.0)))
(/ (/ (+ 1.0 alpha) beta) beta)))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.55e+16) {
tmp = ((beta + 1.0) / ((beta + 2.0) * (beta + 2.0))) / (1.0 + ((beta + alpha) + 2.0));
} 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 <= 1.55d+16) then
tmp = ((beta + 1.0d0) / ((beta + 2.0d0) * (beta + 2.0d0))) / (1.0d0 + ((beta + alpha) + 2.0d0))
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 <= 1.55e+16) {
tmp = ((beta + 1.0) / ((beta + 2.0) * (beta + 2.0))) / (1.0 + ((beta + alpha) + 2.0));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 1.55e+16: tmp = ((beta + 1.0) / ((beta + 2.0) * (beta + 2.0))) / (1.0 + ((beta + alpha) + 2.0)) else: tmp = ((1.0 + alpha) / beta) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.55e+16) tmp = Float64(Float64(Float64(beta + 1.0) / Float64(Float64(beta + 2.0) * Float64(beta + 2.0))) / Float64(1.0 + Float64(Float64(beta + alpha) + 2.0))); 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 <= 1.55e+16)
tmp = ((beta + 1.0) / ((beta + 2.0) * (beta + 2.0))) / (1.0 + ((beta + alpha) + 2.0));
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, 1.55e+16], N[(N[(N[(beta + 1.0), $MachinePrecision] / N[(N[(beta + 2.0), $MachinePrecision] * N[(beta + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]), $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 1.55 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{\beta + 1}{\left(\beta + 2\right) \cdot \left(\beta + 2\right)}}{1 + \left(\left(\beta + \alpha\right) + 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.55e16Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6470.6
Applied rewrites70.6%
if 1.55e16 < beta Initial program 83.0%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6481.6
Applied rewrites81.6%
Applied rewrites82.3%
Final simplification74.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 1.25e+55) (/ (/ (+ beta 1.0) (+ beta 3.0)) (fma beta (+ beta 4.0) 4.0)) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.25e+55) {
tmp = ((beta + 1.0) / (beta + 3.0)) / fma(beta, (beta + 4.0), 4.0);
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.25e+55) tmp = Float64(Float64(Float64(beta + 1.0) / Float64(beta + 3.0)) / fma(beta, Float64(beta + 4.0), 4.0)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.25e+55], N[(N[(N[(beta + 1.0), $MachinePrecision] / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision] / N[(beta * N[(beta + 4.0), $MachinePrecision] + 4.0), $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 1.25 \cdot 10^{+55}:\\
\;\;\;\;\frac{\frac{\beta + 1}{\beta + 3}}{\mathsf{fma}\left(\beta, \beta + 4, 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.25000000000000011e55Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6468.7
Applied rewrites68.7%
Taylor expanded in beta around 0
Applied rewrites68.7%
Applied rewrites68.7%
if 1.25000000000000011e55 < beta Initial program 81.2%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.5
Applied rewrites83.5%
Applied rewrites84.4%
Final simplification73.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 1.35e+30) (/ (+ beta 1.0) (* (+ beta 3.0) (fma beta (+ beta 4.0) 4.0))) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.35e+30) {
tmp = (beta + 1.0) / ((beta + 3.0) * fma(beta, (beta + 4.0), 4.0));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.35e+30) tmp = Float64(Float64(beta + 1.0) / Float64(Float64(beta + 3.0) * fma(beta, Float64(beta + 4.0), 4.0))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.35e+30], N[(N[(beta + 1.0), $MachinePrecision] / N[(N[(beta + 3.0), $MachinePrecision] * N[(beta * N[(beta + 4.0), $MachinePrecision] + 4.0), $MachinePrecision]), $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 1.35 \cdot 10^{+30}:\\
\;\;\;\;\frac{\beta + 1}{\left(\beta + 3\right) \cdot \mathsf{fma}\left(\beta, \beta + 4, 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.3499999999999999e30Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6468.5
Applied rewrites68.5%
Taylor expanded in beta around 0
Applied rewrites68.5%
if 1.3499999999999999e30 < beta Initial program 82.1%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.2
Applied rewrites83.2%
Applied rewrites83.9%
Final simplification73.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 1.35e+30) (/ (+ beta 1.0) (fma beta (fma beta (+ beta 7.0) 16.0) 12.0)) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.35e+30) {
tmp = (beta + 1.0) / fma(beta, fma(beta, (beta + 7.0), 16.0), 12.0);
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.35e+30) tmp = Float64(Float64(beta + 1.0) / fma(beta, fma(beta, Float64(beta + 7.0), 16.0), 12.0)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.35e+30], N[(N[(beta + 1.0), $MachinePrecision] / N[(beta * N[(beta * N[(beta + 7.0), $MachinePrecision] + 16.0), $MachinePrecision] + 12.0), $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 1.35 \cdot 10^{+30}:\\
\;\;\;\;\frac{\beta + 1}{\mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, \beta + 7, 16\right), 12\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 1.3499999999999999e30Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6468.5
Applied rewrites68.5%
Taylor expanded in beta around 0
Applied rewrites68.5%
if 1.3499999999999999e30 < beta Initial program 82.1%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.2
Applied rewrites83.2%
Applied rewrites83.9%
Final simplification73.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 6.5) (/ 0.25 (+ 1.0 (+ (+ beta alpha) 2.0))) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 6.5) {
tmp = 0.25 / (1.0 + ((beta + alpha) + 2.0));
} 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 <= 6.5d0) then
tmp = 0.25d0 / (1.0d0 + ((beta + alpha) + 2.0d0))
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 <= 6.5) {
tmp = 0.25 / (1.0 + ((beta + alpha) + 2.0));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 6.5: tmp = 0.25 / (1.0 + ((beta + alpha) + 2.0)) else: tmp = ((1.0 + alpha) / beta) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 6.5) tmp = Float64(0.25 / Float64(1.0 + Float64(Float64(beta + alpha) + 2.0))); 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 <= 6.5)
tmp = 0.25 / (1.0 + ((beta + alpha) + 2.0));
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, 6.5], N[(0.25 / N[(1.0 + N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]), $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 6.5:\\
\;\;\;\;\frac{0.25}{1 + \left(\left(\beta + \alpha\right) + 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 6.5Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6470.9
Applied rewrites70.9%
Taylor expanded in beta around 0
Applied rewrites70.6%
if 6.5 < beta Initial program 83.9%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
Applied rewrites79.7%
Final simplification73.7%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 2.2)
(fma
beta
(fma
beta
(fma beta 0.024691358024691357 -0.011574074074074073)
-0.027777777777777776)
0.08333333333333333)
(/ (/ (+ 1.0 alpha) beta) beta)))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.2) {
tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333);
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.2) tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.2], N[(beta * N[(beta * N[(beta * 0.024691358024691357 + -0.011574074074074073), $MachinePrecision] + -0.027777777777777776), $MachinePrecision] + 0.08333333333333333), $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.2:\\
\;\;\;\;\mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, 0.024691358024691357, -0.011574074074074073\right), -0.027777777777777776\right), 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 2.2000000000000002Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6469.1
Applied rewrites69.1%
Taylor expanded in beta around 0
Applied rewrites69.1%
if 2.2000000000000002 < beta Initial program 83.9%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
Applied rewrites79.7%
Final simplification72.7%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 2.2)
(fma
beta
(fma
beta
(fma beta 0.024691358024691357 -0.011574074074074073)
-0.027777777777777776)
0.08333333333333333)
(/ (+ 1.0 alpha) (* beta beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.2) {
tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333);
} else {
tmp = (1.0 + alpha) / (beta * beta);
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.2) tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333); else tmp = Float64(Float64(1.0 + alpha) / Float64(beta * beta)); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.2], N[(beta * N[(beta * N[(beta * 0.024691358024691357 + -0.011574074074074073), $MachinePrecision] + -0.027777777777777776), $MachinePrecision] + 0.08333333333333333), $MachinePrecision], N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.2:\\
\;\;\;\;\mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, 0.024691358024691357, -0.011574074074074073\right), -0.027777777777777776\right), 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \alpha}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 2.2000000000000002Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6469.1
Applied rewrites69.1%
Taylor expanded in beta around 0
Applied rewrites69.1%
if 2.2000000000000002 < beta Initial program 83.9%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 2.1)
(fma
beta
(fma
beta
(fma beta 0.024691358024691357 -0.011574074074074073)
-0.027777777777777776)
0.08333333333333333)
(/ 1.0 (* beta beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.1) {
tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333);
} else {
tmp = 1.0 / (beta * beta);
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.1) tmp = fma(beta, fma(beta, fma(beta, 0.024691358024691357, -0.011574074074074073), -0.027777777777777776), 0.08333333333333333); else tmp = Float64(1.0 / Float64(beta * beta)); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.1], N[(beta * N[(beta * N[(beta * 0.024691358024691357 + -0.011574074074074073), $MachinePrecision] + -0.027777777777777776), $MachinePrecision] + 0.08333333333333333), $MachinePrecision], N[(1.0 / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.1:\\
\;\;\;\;\mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, 0.024691358024691357, -0.011574074074074073\right), -0.027777777777777776\right), 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 2.10000000000000009Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6469.1
Applied rewrites69.1%
Taylor expanded in beta around 0
Applied rewrites69.1%
if 2.10000000000000009 < beta Initial program 83.9%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
Taylor expanded in alpha around 0
Applied rewrites78.1%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 1.65)
(fma
beta
(fma beta -0.011574074074074073 -0.027777777777777776)
0.08333333333333333)
(/ 1.0 (* beta beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.65) {
tmp = fma(beta, fma(beta, -0.011574074074074073, -0.027777777777777776), 0.08333333333333333);
} else {
tmp = 1.0 / (beta * beta);
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.65) tmp = fma(beta, fma(beta, -0.011574074074074073, -0.027777777777777776), 0.08333333333333333); else tmp = Float64(1.0 / Float64(beta * beta)); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.65], N[(beta * N[(beta * -0.011574074074074073 + -0.027777777777777776), $MachinePrecision] + 0.08333333333333333), $MachinePrecision], N[(1.0 / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.65:\\
\;\;\;\;\mathsf{fma}\left(\beta, \mathsf{fma}\left(\beta, -0.011574074074074073, -0.027777777777777776\right), 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 1.6499999999999999Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6469.1
Applied rewrites69.1%
Taylor expanded in beta around 0
Applied rewrites69.1%
if 1.6499999999999999 < beta Initial program 83.9%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
Taylor expanded in alpha around 0
Applied rewrites78.1%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 6.5e+98) (/ 0.25 (+ beta 3.0)) (/ alpha (* beta beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 6.5e+98) {
tmp = 0.25 / (beta + 3.0);
} else {
tmp = 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 <= 6.5d+98) then
tmp = 0.25d0 / (beta + 3.0d0)
else
tmp = alpha / (beta * beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 6.5e+98) {
tmp = 0.25 / (beta + 3.0);
} else {
tmp = alpha / (beta * beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 6.5e+98: tmp = 0.25 / (beta + 3.0) else: tmp = alpha / (beta * beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 6.5e+98) tmp = Float64(0.25 / Float64(beta + 3.0)); else tmp = Float64(alpha / Float64(beta * beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 6.5e+98)
tmp = 0.25 / (beta + 3.0);
else
tmp = 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, 6.5e+98], N[(0.25 / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision], N[(alpha / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 6.5 \cdot 10^{+98}:\\
\;\;\;\;\frac{0.25}{\beta + 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 6.4999999999999999e98Initial program 99.8%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6470.3
Applied rewrites70.3%
Taylor expanded in alpha around 0
+-commutativeN/A
lower-+.f6468.7
Applied rewrites68.7%
Taylor expanded in beta around 0
Applied rewrites60.0%
if 6.4999999999999999e98 < beta Initial program 76.5%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6487.5
Applied rewrites87.5%
Taylor expanded in alpha around inf
Applied rewrites68.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (/ 0.25 (+ beta 3.0)))
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.25 / (beta + 3.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
code = 0.25d0 / (beta + 3.0d0)
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.25 / (beta + 3.0);
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.25 / (beta + 3.0)
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return Float64(0.25 / Float64(beta + 3.0)) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.25 / (beta + 3.0);
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := N[(0.25 / N[(beta + 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\frac{0.25}{\beta + 3}
\end{array}
Initial program 94.4%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6474.2
Applied rewrites74.2%
Taylor expanded in alpha around 0
+-commutativeN/A
lower-+.f6472.6
Applied rewrites72.6%
Taylor expanded in beta around 0
Applied rewrites47.8%
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.4%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6469.1
Applied rewrites69.1%
Taylor expanded in beta around 0
Applied rewrites46.3%
herbie shell --seed 2024222
(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)))