(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (/ (+ x 1.0) (+ x -1.0))) (t_1 (/ x (+ x 1.0))))
(if (<= (+ t_1 (/ (- -1.0 x) (+ x -1.0))) 0.0004)
(+
(/ -3.0 x)
(+ (/ -3.0 (pow x 3.0)) (+ (/ (/ -1.0 x) x) (/ -1.0 (pow x 4.0)))))
(/
(exp (log (- (pow t_1 3.0) (pow t_0 3.0))))
(fma t_0 (+ t_1 t_0) (pow t_1 2.0))))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double t_0 = (x + 1.0) / (x + -1.0);
double t_1 = x / (x + 1.0);
double tmp;
if ((t_1 + ((-1.0 - x) / (x + -1.0))) <= 0.0004) {
tmp = (-3.0 / x) + ((-3.0 / pow(x, 3.0)) + (((-1.0 / x) / x) + (-1.0 / pow(x, 4.0))));
} else {
tmp = exp(log((pow(t_1, 3.0) - pow(t_0, 3.0)))) / fma(t_0, (t_1 + t_0), pow(t_1, 2.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(x + 1.0) / Float64(x + -1.0)) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 + Float64(Float64(-1.0 - x) / Float64(x + -1.0))) <= 0.0004) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-3.0 / (x ^ 3.0)) + Float64(Float64(Float64(-1.0 / x) / x) + Float64(-1.0 / (x ^ 4.0))))); else tmp = Float64(exp(log(Float64((t_1 ^ 3.0) - (t_0 ^ 3.0)))) / fma(t_0, Float64(t_1 + t_0), (t_1 ^ 2.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[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(N[(-1.0 - x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0004], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[Log[N[(N[Power[t$95$1, 3.0], $MachinePrecision] - N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[(t$95$1 + t$95$0), $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \frac{x + 1}{x + -1}\\
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;t_1 + \frac{-1 - x}{x + -1} \leq 0.0004:\\
\;\;\;\;\frac{-3}{x} + \left(\frac{-3}{{x}^{3}} + \left(\frac{\frac{-1}{x}}{x} + \frac{-1}{{x}^{4}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left({t_1}^{3} - {t_0}^{3}\right)}}{\mathsf{fma}\left(t_0, t_1 + t_0, {t_1}^{2}\right)}\\
\end{array}



Bits error versus x
if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 4.00000000000000019e-4Initial program 58.7
Taylor expanded in x around inf 0.6
Simplified0.3
if 4.00000000000000019e-4 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) Initial program 0.0
Applied egg-rr0.0
Applied egg-rr0.0
Final simplification0.2
herbie shell --seed 2022178
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))