\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\]
↓
\[\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 90.93146838917038:\\
\;\;\;\;\mathsf{fma}\left(x + 1, \frac{1}{1 - x}, \frac{x}{x + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (/ (- -3.0 (/ (+ 1.0 (/ 3.0 x)) x)) x)))
(if (<= x -80162780.40680923)
t_0
(if (<= x 90.93146838917038)
(fma (+ x 1.0) (/ 1.0 (- 1.0 x)) (/ x (+ x 1.0)))
t_0))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
↓
double code(double x) {
double t_0 = (-3.0 - ((1.0 + (3.0 / x)) / x)) / x;
double tmp;
if (x <= -80162780.40680923) {
tmp = t_0;
} else if (x <= 90.93146838917038) {
tmp = fma((x + 1.0), (1.0 / (1.0 - x)), (x / (x + 1.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x)
return Float64(Float64(x / Float64(x + 1.0)) - Float64(Float64(x + 1.0) / Float64(x - 1.0)))
end
↓
function code(x)
t_0 = Float64(Float64(-3.0 - Float64(Float64(1.0 + Float64(3.0 / x)) / x)) / x)
tmp = 0.0
if (x <= -80162780.40680923)
tmp = t_0;
elseif (x <= 90.93146838917038)
tmp = fma(Float64(x + 1.0), Float64(1.0 / Float64(1.0 - x)), Float64(x / Float64(x + 1.0)));
else
tmp = t_0;
end
return tmp
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]
↓
code[x_] := Block[{t$95$0 = N[(N[(-3.0 - N[(N[(1.0 + N[(3.0 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -80162780.40680923], t$95$0, If[LessEqual[x, 90.93146838917038], N[(N[(x + 1.0), $MachinePrecision] * N[(1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
↓
\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 90.93146838917038:\\
\;\;\;\;\mathsf{fma}\left(x + 1, \frac{1}{1 - x}, \frac{x}{x + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 1736 |
|---|
\[\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 90.93146838917038:\\
\;\;\;\;\frac{\left(x + -1\right) + \left(x + 1\right) \cdot \frac{-1 - x}{x}}{\left(x + -1\right) \cdot \frac{x + 1}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.1 |
|---|
| Cost | 1224 |
|---|
\[\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 90.93146838917038:\\
\;\;\;\;\frac{x}{x + 1} - \frac{1}{\frac{x + -1}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.8 |
|---|
| Cost | 1096 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;\frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;x - \left(-1 + x \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x} + \frac{-1 - \frac{3}{x}}{x \cdot x}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.1 |
|---|
| Cost | 1096 |
|---|
\[\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 90.93146838917038:\\
\;\;\;\;\frac{x}{x + 1} + \frac{-1 - x}{x + -1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.8 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
t_0 := \frac{-3 - \frac{1 + \frac{3}{x}}{x}}{x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;x - \left(-1 + x \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.9 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_0 := \frac{-3}{x} + \frac{-1}{x \cdot x}\\
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;x - \left(-1 + x \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 1.1 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;x - \left(-1 + x \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 1.1 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;1 + x \cdot 3\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 1.4 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -80162780.40680923:\\
\;\;\;\;\frac{-3}{x}\\
\mathbf{elif}\;x \leq 0.17384801702489983:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 31.6 |
|---|
| Cost | 64 |
|---|
\[1
\]