
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x - 1.0d0))
end function
public static double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
def code(x): return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
function code(x) return Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x - 1.0))) end
function tmp = code(x) tmp = (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)); end
code[x_] := N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x - 1.0d0))
end function
public static double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
def code(x): return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
function code(x) return Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x - 1.0))) end
function tmp = code(x) tmp = (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)); end
code[x_] := N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\end{array}
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(+
(/ -3.0 (pow x 3.0))
(+ (/ (/ -1.0 x) x) (- (/ -1.0 (pow x 4.0)) (/ 3.0 x))))
(/
(+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x))
(/ 1.0 (/ (/ (fma x x x) (+ x 1.0)) (+ x -1.0))))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = (-3.0 / pow(x, 3.0)) + (((-1.0 / x) / x) + ((-1.0 / pow(x, 4.0)) - (3.0 / x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 / ((fma(x, x, x) / (x + 1.0)) / (x + -1.0)));
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(Float64(-3.0 / (x ^ 3.0)) + Float64(Float64(Float64(-1.0 / x) / x) + Float64(Float64(-1.0 / (x ^ 4.0)) - Float64(3.0 / x)))); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(1.0 / Float64(Float64(fma(x, x, x) / Float64(x + 1.0)) / Float64(x + -1.0)))); end return tmp end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision] + N[(N[(-1.0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] - N[(3.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(N[(N[(x * x + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-3}{{x}^{3}} + \left(\frac{\frac{-1}{x}}{x} + \left(\frac{-1}{{x}^{4}} - \frac{3}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{\frac{1}{\frac{\frac{\mathsf{fma}\left(x, x, x\right)}{x + 1}}{x + -1}}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
Taylor expanded in x around inf 99.2%
distribute-neg-in99.2%
unsub-neg99.2%
associate-*r/99.2%
metadata-eval99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
+-commutative99.2%
associate-+l+99.2%
unpow299.2%
associate-/r*99.2%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
clear-num100.0%
frac-sub100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
clear-num100.0%
clear-num100.0%
frac-times99.9%
metadata-eval99.9%
Applied egg-rr99.9%
associate-*r/100.0%
associate-*l/100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(/
1.0
(-
(+
0.1111111111111111
(fma -0.3333333333333333 x (/ 0.2962962962962963 x)))
(/ 0.09876543209876543 (* x x))))
(/
(+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x))
(/ 1.0 (/ (/ (fma x x x) (+ x 1.0)) (+ x -1.0))))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + fma(-0.3333333333333333, x, (0.2962962962962963 / x))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 / ((fma(x, x, x) / (x + 1.0)) / (x + -1.0)));
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(1.0 / Float64(Float64(0.1111111111111111 + fma(-0.3333333333333333, x, Float64(0.2962962962962963 / x))) - Float64(0.09876543209876543 / Float64(x * x)))); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(1.0 / Float64(Float64(fma(x, x, x) / Float64(x + 1.0)) / Float64(x + -1.0)))); end return tmp end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(1.0 / N[(N[(0.1111111111111111 + N[(-0.3333333333333333 * x + N[(0.2962962962962963 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.09876543209876543 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(N[(N[(x * x + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(0.1111111111111111 + \mathsf{fma}\left(-0.3333333333333333, x, \frac{0.2962962962962963}{x}\right)\right) - \frac{0.09876543209876543}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{\frac{1}{\frac{\frac{\mathsf{fma}\left(x, x, x\right)}{x + 1}}{x + -1}}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
flip--8.3%
clear-num8.3%
sub-neg8.3%
metadata-eval8.3%
pow28.3%
pow18.3%
pow-plus8.3%
clear-num8.3%
inv-pow8.3%
metadata-eval8.3%
pow-pow8.5%
Applied egg-rr8.5%
Taylor expanded in x around inf 99.2%
fma-def99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
Simplified99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
clear-num100.0%
frac-sub100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
clear-num100.0%
clear-num100.0%
frac-times99.9%
metadata-eval99.9%
Applied egg-rr99.9%
associate-*r/100.0%
associate-*l/100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.6%
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(/
1.0
(-
(+
0.1111111111111111
(fma -0.3333333333333333 x (/ 0.2962962962962963 x)))
(/ 0.09876543209876543 (* x x))))
(/
(+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x))
(/ (+ x -1.0) (/ (+ x (* x x)) (+ x 1.0))))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + fma(-0.3333333333333333, x, (0.2962962962962963 / x))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / ((x + (x * x)) / (x + 1.0)));
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(1.0 / Float64(Float64(0.1111111111111111 + fma(-0.3333333333333333, x, Float64(0.2962962962962963 / x))) - Float64(0.09876543209876543 / Float64(x * x)))); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(Float64(x + -1.0) / Float64(Float64(x + Float64(x * x)) / Float64(x + 1.0)))); end return tmp end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(1.0 / N[(N[(0.1111111111111111 + N[(-0.3333333333333333 * x + N[(0.2962962962962963 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.09876543209876543 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + -1.0), $MachinePrecision] / N[(N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(0.1111111111111111 + \mathsf{fma}\left(-0.3333333333333333, x, \frac{0.2962962962962963}{x}\right)\right) - \frac{0.09876543209876543}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{\frac{x + -1}{\frac{x + x \cdot x}{x + 1}}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
flip--8.3%
clear-num8.3%
sub-neg8.3%
metadata-eval8.3%
pow28.3%
pow18.3%
pow-plus8.3%
clear-num8.3%
inv-pow8.3%
metadata-eval8.3%
pow-pow8.5%
Applied egg-rr8.5%
Taylor expanded in x around inf 99.2%
fma-def99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
Simplified99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
clear-num100.0%
frac-sub100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
associate-*l/100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
sub-neg100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
sub-neg100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.6%
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(/
1.0
(-
(+
0.1111111111111111
(+ (/ 0.2962962962962963 x) (* x -0.3333333333333333)))
(/ 0.09876543209876543 (* x x))))
(/
(+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x))
(/ (+ x -1.0) (/ (+ x (* x x)) (+ x 1.0))))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / ((x + (x * x)) / (x + 1.0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-9) then
tmp = 1.0d0 / ((0.1111111111111111d0 + ((0.2962962962962963d0 / x) + (x * (-0.3333333333333333d0)))) - (0.09876543209876543d0 / (x * x)))
else
tmp = (((x + (-1.0d0)) / (x + 1.0d0)) + (((-1.0d0) - x) / x)) / ((x + (-1.0d0)) / ((x + (x * x)) / (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / ((x + (x * x)) / (x + 1.0)));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9: tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))) else: tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / ((x + (x * x)) / (x + 1.0))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(1.0 / Float64(Float64(0.1111111111111111 + Float64(Float64(0.2962962962962963 / x) + Float64(x * -0.3333333333333333))) - Float64(0.09876543209876543 / Float64(x * x)))); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(Float64(x + -1.0) / Float64(Float64(x + Float64(x * x)) / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))); else tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / ((x + -1.0) / ((x + (x * x)) / (x + 1.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(1.0 / N[(N[(0.1111111111111111 + N[(N[(0.2962962962962963 / x), $MachinePrecision] + N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.09876543209876543 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + -1.0), $MachinePrecision] / N[(N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(0.1111111111111111 + \left(\frac{0.2962962962962963}{x} + x \cdot -0.3333333333333333\right)\right) - \frac{0.09876543209876543}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{\frac{x + -1}{\frac{x + x \cdot x}{x + 1}}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
flip--8.3%
clear-num8.3%
sub-neg8.3%
metadata-eval8.3%
pow28.3%
pow18.3%
pow-plus8.3%
clear-num8.3%
inv-pow8.3%
metadata-eval8.3%
pow-pow8.5%
Applied egg-rr8.5%
Taylor expanded in x around inf 99.2%
fma-def99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
Simplified99.2%
fma-udef99.2%
Applied egg-rr99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
clear-num100.0%
frac-sub100.0%
*-un-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
associate-*l/100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
sub-neg100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
sub-neg100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.6%
(FPCore (x)
:precision binary64
(if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(/
1.0
(-
(+
0.1111111111111111
(+ (/ 0.2962962962962963 x) (* x -0.3333333333333333)))
(/ 0.09876543209876543 (* x x))))
(/ (+ (/ (+ x -1.0) (+ x 1.0)) (/ (- -1.0 x) x)) (+ 1.0 (/ -1.0 x)))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 + (-1.0 / x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-9) then
tmp = 1.0d0 / ((0.1111111111111111d0 + ((0.2962962962962963d0 / x) + (x * (-0.3333333333333333d0)))) - (0.09876543209876543d0 / (x * x)))
else
tmp = (((x + (-1.0d0)) / (x + 1.0d0)) + (((-1.0d0) - x) / x)) / (1.0d0 + ((-1.0d0) / x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 + (-1.0 / x));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9: tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))) else: tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 + (-1.0 / x)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(1.0 / Float64(Float64(0.1111111111111111 + Float64(Float64(0.2962962962962963 / x) + Float64(x * -0.3333333333333333))) - Float64(0.09876543209876543 / Float64(x * x)))); else tmp = Float64(Float64(Float64(Float64(x + -1.0) / Float64(x + 1.0)) + Float64(Float64(-1.0 - x) / x)) / Float64(1.0 + Float64(-1.0 / x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))); else tmp = (((x + -1.0) / (x + 1.0)) + ((-1.0 - x) / x)) / (1.0 + (-1.0 / x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(1.0 / N[(N[(0.1111111111111111 + N[(N[(0.2962962962962963 / x), $MachinePrecision] + N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.09876543209876543 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(0.1111111111111111 + \left(\frac{0.2962962962962963}{x} + x \cdot -0.3333333333333333\right)\right) - \frac{0.09876543209876543}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + -1}{x + 1} + \frac{-1 - x}{x}}{1 + \frac{-1}{x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
flip--8.3%
clear-num8.3%
sub-neg8.3%
metadata-eval8.3%
pow28.3%
pow18.3%
pow-plus8.3%
clear-num8.3%
inv-pow8.3%
metadata-eval8.3%
pow-pow8.5%
Applied egg-rr8.5%
Taylor expanded in x around inf 99.2%
fma-def99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
Simplified99.2%
fma-udef99.2%
Applied egg-rr99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.9%
*-rgt-identity99.9%
clear-num100.0%
sub-neg100.0%
metadata-eval100.0%
frac-sub100.0%
*-un-lft-identity100.0%
*-rgt-identity100.0%
*-rgt-identity100.0%
*-commutative100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= (- t_0 (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(/
1.0
(-
(+
0.1111111111111111
(+ (/ 0.2962962962962963 x) (* x -0.3333333333333333)))
(/ 0.09876543209876543 (* x x))))
(+ t_0 (* (+ x 1.0) (/ -1.0 (+ x -1.0)))))))
double code(double x) {
double t_0 = x / (x + 1.0);
double tmp;
if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if ((t_0 - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-9) then
tmp = 1.0d0 / ((0.1111111111111111d0 + ((0.2962962962962963d0 / x) + (x * (-0.3333333333333333d0)))) - (0.09876543209876543d0 / (x * x)))
else
tmp = t_0 + ((x + 1.0d0) * ((-1.0d0) / (x + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double tmp;
if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x)));
} else {
tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0)));
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) tmp = 0 if (t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9: tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))) else: tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0))) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (Float64(t_0 - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(1.0 / Float64(Float64(0.1111111111111111 + Float64(Float64(0.2962962962962963 / x) + Float64(x * -0.3333333333333333))) - Float64(0.09876543209876543 / Float64(x * x)))); else tmp = Float64(t_0 + Float64(Float64(x + 1.0) * Float64(-1.0 / Float64(x + -1.0)))); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); tmp = 0.0; if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) tmp = 1.0 / ((0.1111111111111111 + ((0.2962962962962963 / x) + (x * -0.3333333333333333))) - (0.09876543209876543 / (x * x))); else tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(1.0 / N[(N[(0.1111111111111111 + N[(N[(0.2962962962962963 / x), $MachinePrecision] + N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.09876543209876543 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(x + 1.0), $MachinePrecision] * N[(-1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;t_0 - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(0.1111111111111111 + \left(\frac{0.2962962962962963}{x} + x \cdot -0.3333333333333333\right)\right) - \frac{0.09876543209876543}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(x + 1\right) \cdot \frac{-1}{x + -1}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
flip--8.3%
clear-num8.3%
sub-neg8.3%
metadata-eval8.3%
pow28.3%
pow18.3%
pow-plus8.3%
clear-num8.3%
inv-pow8.3%
metadata-eval8.3%
pow-pow8.5%
Applied egg-rr8.5%
Taylor expanded in x around inf 99.2%
fma-def99.2%
associate-*r/99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
unpow299.2%
Simplified99.2%
fma-udef99.2%
Applied egg-rr99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (<= (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))) 5e-9) (+ (/ -3.0 x) (/ (/ -1.0 x) x)) (+ (* x (/ 1.0 (+ x 1.0))) (/ (- -1.0 x) (+ x -1.0)))))
double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = (x * (1.0 / (x + 1.0))) + ((-1.0 - x) / (x + -1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-9) then
tmp = ((-3.0d0) / x) + (((-1.0d0) / x) / x)
else
tmp = (x * (1.0d0 / (x + 1.0d0))) + (((-1.0d0) - x) / (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = (x * (1.0 / (x + 1.0))) + ((-1.0 - x) / (x + -1.0));
}
return tmp;
}
def code(x): tmp = 0 if ((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9: tmp = (-3.0 / x) + ((-1.0 / x) / x) else: tmp = (x * (1.0 / (x + 1.0))) + ((-1.0 - x) / (x + -1.0)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / x) / x)); else tmp = Float64(Float64(x * Float64(1.0 / Float64(x + 1.0))) + Float64(Float64(-1.0 - x) / Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((x / (x + 1.0)) - ((x + 1.0) / (x + -1.0))) <= 5e-9) tmp = (-3.0 / x) + ((-1.0 / x) / x); else tmp = (x * (1.0 / (x + 1.0))) + ((-1.0 - x) / (x + -1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{x + 1} + \frac{-1 - x}{x + -1}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
Taylor expanded in x around inf 98.7%
distribute-neg-in98.7%
unsub-neg98.7%
associate-*r/99.2%
metadata-eval99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
unpow299.2%
associate-/r*99.2%
Simplified99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= (- t_0 (/ (+ x 1.0) (+ x -1.0))) 5e-9)
(+ (/ -3.0 x) (/ (/ -1.0 x) x))
(+ t_0 (* (+ x 1.0) (/ -1.0 (+ x -1.0)))))))
double code(double x) {
double t_0 = x / (x + 1.0);
double tmp;
if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if ((t_0 - ((x + 1.0d0) / (x + (-1.0d0)))) <= 5d-9) then
tmp = ((-3.0d0) / x) + (((-1.0d0) / x) / x)
else
tmp = t_0 + ((x + 1.0d0) * ((-1.0d0) / (x + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = x / (x + 1.0);
double tmp;
if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0)));
}
return tmp;
}
def code(x): t_0 = x / (x + 1.0) tmp = 0 if (t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9: tmp = (-3.0 / x) + ((-1.0 / x) / x) else: tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0))) return tmp
function code(x) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (Float64(t_0 - Float64(Float64(x + 1.0) / Float64(x + -1.0))) <= 5e-9) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / x) / x)); else tmp = Float64(t_0 + Float64(Float64(x + 1.0) * Float64(-1.0 / Float64(x + -1.0)))); end return tmp end
function tmp_2 = code(x) t_0 = x / (x + 1.0); tmp = 0.0; if ((t_0 - ((x + 1.0) / (x + -1.0))) <= 5e-9) tmp = (-3.0 / x) + ((-1.0 / x) / x); else tmp = t_0 + ((x + 1.0) * (-1.0 / (x + -1.0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-9], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(x + 1.0), $MachinePrecision] * N[(-1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;t_0 - \frac{x + 1}{x + -1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(x + 1\right) \cdot \frac{-1}{x + -1}\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
Taylor expanded in x around inf 98.7%
distribute-neg-in98.7%
unsub-neg98.7%
associate-*r/99.2%
metadata-eval99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
unpow299.2%
associate-/r*99.2%
Simplified99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
clear-num100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification99.6%
(FPCore (x) :precision binary64 (let* ((t_0 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (+ x -1.0))))) (if (<= t_0 5e-9) (+ (/ -3.0 x) (/ (/ -1.0 x) x)) t_0)))
double code(double x) {
double t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0));
double tmp;
if (t_0 <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x + (-1.0d0)))
if (t_0 <= 5d-9) then
tmp = ((-3.0d0) / x) + (((-1.0d0) / x) / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x) {
double t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0));
double tmp;
if (t_0 <= 5e-9) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x): t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0)) tmp = 0 if t_0 <= 5e-9: tmp = (-3.0 / x) + ((-1.0 / x) / x) else: tmp = t_0 return tmp
function code(x) t_0 = Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x + -1.0))) tmp = 0.0 if (t_0 <= 5e-9) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / x) / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x) t_0 = (x / (x + 1.0)) - ((x + 1.0) / (x + -1.0)); tmp = 0.0; if (t_0 <= 5e-9) tmp = (-3.0 / x) + ((-1.0 / x) / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-9], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1} - \frac{x + 1}{x + -1}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 5.0000000000000001e-9Initial program 8.3%
Taylor expanded in x around inf 98.7%
distribute-neg-in98.7%
unsub-neg98.7%
associate-*r/99.2%
metadata-eval99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
unpow299.2%
associate-/r*99.2%
Simplified99.2%
if 5.0000000000000001e-9 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 99.9%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ (/ -3.0 x) (/ (/ -1.0 x) x)) (+ 1.0 (* x (+ x 3.0)))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = ((-3.0d0) / x) + (((-1.0d0) / x) / x)
else
tmp = 1.0d0 + (x * (x + 3.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (-3.0 / x) + ((-1.0 / x) / x) else: tmp = 1.0 + (x * (x + 3.0)) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / x) / x)); else tmp = Float64(1.0 + Float64(x * Float64(x + 3.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (-3.0 / x) + ((-1.0 / x) / x); else tmp = 1.0 + (x * (x + 3.0)); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + 3\right)\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 9.7%
Taylor expanded in x around inf 97.6%
distribute-neg-in97.6%
unsub-neg97.6%
associate-*r/98.0%
metadata-eval98.0%
distribute-neg-frac98.0%
metadata-eval98.0%
unpow298.0%
associate-/r*98.0%
Simplified98.0%
if -1 < x < 1Initial program 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
distribute-rgt-out100.0%
Simplified100.0%
Final simplification99.0%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ -3.0 x) (+ 1.0 (* x (+ x 3.0)))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (-3.0d0) / x
else
tmp = 1.0d0 + (x * (x + 3.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = -3.0 / x else: tmp = 1.0 + (x * (x + 3.0)) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(-3.0 / x); else tmp = Float64(1.0 + Float64(x * Float64(x + 3.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = -3.0 / x; else tmp = 1.0 + (x * (x + 3.0)); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(-3.0 / x), $MachinePrecision], N[(1.0 + N[(x * N[(x + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + 3\right)\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 9.7%
Taylor expanded in x around inf 97.1%
if -1 < x < 1Initial program 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
distribute-rgt-out100.0%
Simplified100.0%
Final simplification98.6%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ 1.0 (+ 0.1111111111111111 (* x -0.3333333333333333))) (+ 1.0 (* x (+ x 3.0)))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 / (0.1111111111111111 + (x * -0.3333333333333333));
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = 1.0d0 / (0.1111111111111111d0 + (x * (-0.3333333333333333d0)))
else
tmp = 1.0d0 + (x * (x + 3.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 / (0.1111111111111111 + (x * -0.3333333333333333));
} else {
tmp = 1.0 + (x * (x + 3.0));
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = 1.0 / (0.1111111111111111 + (x * -0.3333333333333333)) else: tmp = 1.0 + (x * (x + 3.0)) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(1.0 / Float64(0.1111111111111111 + Float64(x * -0.3333333333333333))); else tmp = Float64(1.0 + Float64(x * Float64(x + 3.0))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = 1.0 / (0.1111111111111111 + (x * -0.3333333333333333)); else tmp = 1.0 + (x * (x + 3.0)); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(1.0 / N[(0.1111111111111111 + N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{1}{0.1111111111111111 + x \cdot -0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x + 3\right)\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 9.7%
flip--9.7%
clear-num9.8%
sub-neg9.8%
metadata-eval9.8%
pow29.8%
pow19.8%
pow-plus9.8%
clear-num9.8%
inv-pow9.8%
metadata-eval9.8%
pow-pow9.9%
Applied egg-rr9.9%
Taylor expanded in x around inf 97.5%
+-commutative97.5%
*-commutative97.5%
Simplified97.5%
if -1 < x < 1Initial program 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
distribute-rgt-out100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ -3.0 x) (+ 1.0 (* x 3.0))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * 3.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (-3.0d0) / x
else
tmp = 1.0d0 + (x * 3.0d0)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = -3.0 / x;
} else {
tmp = 1.0 + (x * 3.0);
}
return tmp;
}
def code(x): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = -3.0 / x else: tmp = 1.0 + (x * 3.0) return tmp
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(-3.0 / x); else tmp = Float64(1.0 + Float64(x * 3.0)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = -3.0 / x; else tmp = 1.0 + (x * 3.0); end tmp_2 = tmp; end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(-3.0 / x), $MachinePrecision], N[(1.0 + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot 3\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 9.7%
Taylor expanded in x around inf 97.1%
if -1 < x < 1Initial program 100.0%
Taylor expanded in x around 0 99.9%
Final simplification98.5%
(FPCore (x) :precision binary64 (if (<= x -1.0) (/ -3.0 x) (if (<= x 1.0) 1.0 (/ -3.0 x))))
double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = -3.0 / x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = -3.0 / x;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (-3.0d0) / x
else if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = (-3.0d0) / x
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = -3.0 / x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = -3.0 / x;
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.0: tmp = -3.0 / x elif x <= 1.0: tmp = 1.0 else: tmp = -3.0 / x return tmp
function code(x) tmp = 0.0 if (x <= -1.0) tmp = Float64(-3.0 / x); elseif (x <= 1.0) tmp = 1.0; else tmp = Float64(-3.0 / x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.0) tmp = -3.0 / x; elseif (x <= 1.0) tmp = 1.0; else tmp = -3.0 / x; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.0], N[(-3.0 / x), $MachinePrecision], If[LessEqual[x, 1.0], 1.0, N[(-3.0 / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 9.7%
Taylor expanded in x around inf 97.1%
if -1 < x < 1Initial program 100.0%
Taylor expanded in x around 0 99.0%
Final simplification98.1%
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 55.2%
Taylor expanded in x around 0 51.9%
Final simplification51.9%
herbie shell --seed 2023285
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))