
(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 3e+140)
(/
1.0
(*
(* t_0 (/ t_0 (+ 1.0 (fma alpha beta (+ beta alpha)))))
(+ 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 <= 3e+140) {
tmp = 1.0 / ((t_0 * (t_0 / (1.0 + fma(alpha, beta, (beta + alpha))))) * (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 <= 3e+140) tmp = Float64(1.0 / Float64(Float64(t_0 * Float64(t_0 / Float64(1.0 + fma(alpha, beta, Float64(beta + alpha))))) * 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, 3e+140], N[(1.0 / N[(N[(t$95$0 * N[(t$95$0 / N[(1.0 + N[(alpha * beta + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(alpha + N[(beta + 3.0), $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 3 \cdot 10^{+140}:\\
\;\;\;\;\frac{1}{\left(t\_0 \cdot \frac{t\_0}{1 + \mathsf{fma}\left(\alpha, \beta, \beta + \alpha\right)}\right) \cdot \left(\alpha + \left(\beta + 3\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 2.99999999999999997e140Initial program 98.5%
Applied rewrites98.1%
if 2.99999999999999997e140 < beta Initial program 76.5%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
Final simplification96.9%
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 9.5e+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 <= 9.5e+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 <= 9.5e+17) tmp = Float64(Float64(1.0 + fma(alpha, beta, Float64(beta + alpha))) / Float64(t_0 * Float64(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, 9.5e+17], N[(N[(1.0 + N[(alpha * beta + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 * N[(alpha + N[(beta + 3.0), $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 9.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 + \mathsf{fma}\left(\alpha, \beta, \beta + \alpha\right)}{t\_0 \cdot \left(t\_0 \cdot \left(\alpha + \left(\beta + 3\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 9.5e17Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
Applied rewrites94.2%
if 9.5e17 < beta Initial program 83.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
Final simplification92.2%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 4.3e+17)
(/
(/ (+ beta 1.0) (fma beta (+ beta 4.0) 4.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 <= 4.3e+17) {
tmp = ((beta + 1.0) / fma(beta, (beta + 4.0), 4.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 <= 4.3e+17) tmp = Float64(Float64(Float64(beta + 1.0) / fma(beta, Float64(beta + 4.0), 4.0)) / Float64(1.0 + Float64(Float64(beta + alpha) + 2.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, 4.3e+17], N[(N[(N[(beta + 1.0), $MachinePrecision] / N[(beta * N[(beta + 4.0), $MachinePrecision] + 4.0), $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 4.3 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{\beta + 1}{\mathsf{fma}\left(\beta, \beta + 4, 4\right)}}{1 + \left(\left(\beta + \alpha\right) + 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 4.3e17Initial program 99.9%
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-+.f6471.3
Applied rewrites71.3%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6471.3
Applied rewrites71.3%
if 4.3e17 < beta Initial program 83.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
Final simplification76.3%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 6e+19) (* (- -1.0 beta) (/ 1.0 (* (fma beta (+ beta 4.0) 4.0) (- -3.0 beta)))) (/ (/ (+ 1.0 alpha) beta) beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 6e+19) {
tmp = (-1.0 - beta) * (1.0 / (fma(beta, (beta + 4.0), 4.0) * (-3.0 - beta)));
} else {
tmp = ((1.0 + alpha) / beta) / beta;
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 6e+19) tmp = Float64(Float64(-1.0 - beta) * Float64(1.0 / Float64(fma(beta, Float64(beta + 4.0), 4.0) * Float64(-3.0 - beta)))); 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, 6e+19], N[(N[(-1.0 - beta), $MachinePrecision] * N[(1.0 / N[(N[(beta * N[(beta + 4.0), $MachinePrecision] + 4.0), $MachinePrecision] * N[(-3.0 - beta), $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}
\mathbf{if}\;\beta \leq 6 \cdot 10^{+19}:\\
\;\;\;\;\left(-1 - \beta\right) \cdot \frac{1}{\mathsf{fma}\left(\beta, \beta + 4, 4\right) \cdot \left(-3 - \beta\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 6e19Initial program 99.9%
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-+.f6471.4
Applied rewrites71.4%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6471.4
Applied rewrites71.4%
Taylor expanded in alpha around 0
lower-+.f6470.3
Applied rewrites70.3%
lift-+.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
frac-2negN/A
lift-+.f64N/A
associate-/l/N/A
div-invN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-+.f64N/A
Applied rewrites70.3%
if 6e19 < beta Initial program 83.4%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6482.8
Applied rewrites82.8%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 4.6e+16) (/ (+ 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 <= 4.6e+16) {
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 <= 4.6e+16) 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, 4.6e+16], 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 4.6 \cdot 10^{+16}:\\
\;\;\;\;\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 < 4.6e16Initial program 99.9%
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-+.f6470.2
Applied rewrites70.2%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6470.2
Applied rewrites70.2%
if 4.6e16 < beta Initial program 83.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
Final simplification75.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 4.6e+16) (/ (+ 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 <= 4.6e+16) {
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 <= 4.6e+16) 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, 4.6e+16], 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 4.6 \cdot 10^{+16}:\\
\;\;\;\;\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 < 4.6e16Initial program 99.9%
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-+.f6470.2
Applied rewrites70.2%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6470.2
Applied rewrites70.2%
if 4.6e16 < beta Initial program 83.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
Final simplification75.5%
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)
(if (<= beta 1.35e+154)
(/ (+ 1.0 alpha) (* beta beta))
(/ (/ 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 if (beta <= 1.35e+154) {
tmp = (1.0 + alpha) / (beta * beta);
} else {
tmp = (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); elseif (beta <= 1.35e+154) tmp = Float64(Float64(1.0 + alpha) / Float64(beta * beta)); else tmp = Float64(Float64(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], If[LessEqual[beta, 1.35e+154], N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision], N[(N[(alpha / 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{elif}\;\beta \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 + \alpha}{\beta \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 2.2000000000000002Initial program 99.9%
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-+.f6471.1
Applied rewrites71.1%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6470.8
Applied rewrites70.8%
if 2.2000000000000002 < beta < 1.35000000000000003e154Initial program 89.5%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6477.3
Applied rewrites77.3%
if 1.35000000000000003e154 < beta Initial program 77.4%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6484.0
Applied rewrites84.0%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in alpha around inf
lower-/.f6492.5
Applied rewrites92.5%
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.9%
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-+.f6471.1
Applied rewrites71.1%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6470.8
Applied rewrites70.8%
if 2.2000000000000002 < beta Initial program 84.4%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6484.5
Applied rewrites84.5%
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.9%
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-+.f6471.1
Applied rewrites71.1%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6470.8
Applied rewrites70.8%
if 2.2000000000000002 < beta Initial program 84.4%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
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 (* 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 / (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(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.2], 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.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}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 2.2000000000000002Initial program 99.9%
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-+.f6471.1
Applied rewrites71.1%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6470.8
Applied rewrites70.8%
if 2.2000000000000002 < beta Initial program 84.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-+.f6483.1
Applied rewrites83.1%
Taylor expanded in beta around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6478.4
Applied rewrites78.4%
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.9%
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-+.f6471.1
Applied rewrites71.1%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6470.7
Applied rewrites70.7%
if 1.6499999999999999 < beta Initial program 84.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-+.f6483.1
Applied rewrites83.1%
Taylor expanded in beta around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6478.4
Applied rewrites78.4%
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.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-+.f6475.7
Applied rewrites75.7%
Taylor expanded in beta around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6475.7
Applied rewrites75.7%
Taylor expanded in alpha around 0
lower-+.f6473.5
Applied rewrites73.5%
Taylor expanded in beta around 0
Applied rewrites49.8%
Final simplification49.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (/ 0.25 (+ alpha 3.0)))
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.25 / (alpha + 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 / (alpha + 3.0d0)
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.25 / (alpha + 3.0);
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.25 / (alpha + 3.0)
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return Float64(0.25 / Float64(alpha + 3.0)) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.25 / (alpha + 3.0);
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := N[(0.25 / N[(alpha + 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\frac{0.25}{\alpha + 3}
\end{array}
Initial program 94.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-+.f6475.7
Applied rewrites75.7%
Taylor expanded in beta around 0
lower-/.f64N/A
lower-+.f6449.7
Applied rewrites49.7%
Final simplification49.7%
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%
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.9
Applied rewrites69.9%
Taylor expanded in beta around 0
Applied rewrites48.7%
herbie shell --seed 2024214
(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)))