(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0
(+
(/ -2.0 (pow x 6.0))
(+
(fma (pow x -4.0) -2.0 (* -2.0 (pow x -2.0)))
(/ -2.0 (pow x 8.0))))))
(if (<= x -1e+15)
t_0
(if (<= x 100000.0)
(/ (+ (- 1.0 x) (+ x 1.0)) (* (- 1.0 x) (+ x 1.0)))
t_0))))double code(double x) {
return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
double t_0 = (-2.0 / pow(x, 6.0)) + (fma(pow(x, -4.0), -2.0, (-2.0 * pow(x, -2.0))) + (-2.0 / pow(x, 8.0)));
double tmp;
if (x <= -1e+15) {
tmp = t_0;
} else if (x <= 100000.0) {
tmp = ((1.0 - x) + (x + 1.0)) / ((1.0 - x) * (x + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(x) return Float64(Float64(1.0 / Float64(x + 1.0)) - Float64(1.0 / Float64(x - 1.0))) end
function code(x) t_0 = Float64(Float64(-2.0 / (x ^ 6.0)) + Float64(fma((x ^ -4.0), -2.0, Float64(-2.0 * (x ^ -2.0))) + Float64(-2.0 / (x ^ 8.0)))) tmp = 0.0 if (x <= -1e+15) tmp = t_0; elseif (x <= 100000.0) tmp = Float64(Float64(Float64(1.0 - x) + Float64(x + 1.0)) / Float64(Float64(1.0 - x) * Float64(x + 1.0))); else tmp = t_0; end return tmp end
code[x_] := N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(N[(-2.0 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[x, -4.0], $MachinePrecision] * -2.0 + N[(-2.0 * N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+15], t$95$0, If[LessEqual[x, 100000.0], N[(N[(N[(1.0 - x), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{1}{x + 1} - \frac{1}{x - 1}
\begin{array}{l}
t_0 := \frac{-2}{{x}^{6}} + \left(\mathsf{fma}\left({x}^{-4}, -2, -2 \cdot {x}^{-2}\right) + \frac{-2}{{x}^{8}}\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 100000:\\
\;\;\;\;\frac{\left(1 - x\right) + \left(x + 1\right)}{\left(1 - x\right) \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}



Bits error versus x
if x < -1e15 or 1e5 < x Initial program 30.0
Taylor expanded in x around inf 0.8
Simplified0.8
Applied egg-rr0.0
Applied egg-rr0.0
if -1e15 < x < 1e5Initial program 0.7
Applied egg-rr0.0
Final simplification0.0
herbie shell --seed 2022156
(FPCore (x)
:name "Asymptote A"
:precision binary64
(- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))