(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (+ x 1.0) (+ x -1.0))))
(if (<= x -10731.07214304758)
(+ (/ -3.0 x) (+ (/ -1.0 (* x x)) (/ -3.0 (pow x 3.0))))
(if (<= x 443381.0077497065)
(/ 1.0 (/ (+ t_0 t_1) (- (pow t_0 2.0) (pow t_1 2.0))))
(+ (/ -3.0 x) (/ (/ -1.0 x) x))))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if (x <= -10731.07214304758) {
tmp = (-3.0 / x) + ((-1.0 / (x * x)) + (-3.0 / pow(x, 3.0)));
} else if (x <= 443381.0077497065) {
tmp = 1.0 / ((t_0 + t_1) / (pow(t_0, 2.0) - pow(t_1, 2.0)));
} else {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x / (x + 1.0d0)) - ((x + 1.0d0) / (x - 1.0d0))
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (x + 1.0d0)
t_1 = (x + 1.0d0) / (x + (-1.0d0))
if (x <= (-10731.07214304758d0)) then
tmp = ((-3.0d0) / x) + (((-1.0d0) / (x * x)) + ((-3.0d0) / (x ** 3.0d0)))
else if (x <= 443381.0077497065d0) then
tmp = 1.0d0 / ((t_0 + t_1) / ((t_0 ** 2.0d0) - (t_1 ** 2.0d0)))
else
tmp = ((-3.0d0) / x) + (((-1.0d0) / x) / x)
end if
code = tmp
end function
public static double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
public static double code(double x) {
double t_0 = x / (x + 1.0);
double t_1 = (x + 1.0) / (x + -1.0);
double tmp;
if (x <= -10731.07214304758) {
tmp = (-3.0 / x) + ((-1.0 / (x * x)) + (-3.0 / Math.pow(x, 3.0)));
} else if (x <= 443381.0077497065) {
tmp = 1.0 / ((t_0 + t_1) / (Math.pow(t_0, 2.0) - Math.pow(t_1, 2.0)));
} else {
tmp = (-3.0 / x) + ((-1.0 / x) / x);
}
return tmp;
}
def code(x): return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
def code(x): t_0 = x / (x + 1.0) t_1 = (x + 1.0) / (x + -1.0) tmp = 0 if x <= -10731.07214304758: tmp = (-3.0 / x) + ((-1.0 / (x * x)) + (-3.0 / math.pow(x, 3.0))) elif x <= 443381.0077497065: tmp = 1.0 / ((t_0 + t_1) / (math.pow(t_0, 2.0) - math.pow(t_1, 2.0))) else: tmp = (-3.0 / x) + ((-1.0 / x) / x) 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(x / Float64(x + 1.0)) t_1 = Float64(Float64(x + 1.0) / Float64(x + -1.0)) tmp = 0.0 if (x <= -10731.07214304758) tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / Float64(x * x)) + Float64(-3.0 / (x ^ 3.0)))); elseif (x <= 443381.0077497065) tmp = Float64(1.0 / Float64(Float64(t_0 + t_1) / Float64((t_0 ^ 2.0) - (t_1 ^ 2.0)))); else tmp = Float64(Float64(-3.0 / x) + Float64(Float64(-1.0 / x) / x)); end return tmp end
function tmp = code(x) tmp = (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0)); end
function tmp_2 = code(x) t_0 = x / (x + 1.0); t_1 = (x + 1.0) / (x + -1.0); tmp = 0.0; if (x <= -10731.07214304758) tmp = (-3.0 / x) + ((-1.0 / (x * x)) + (-3.0 / (x ^ 3.0))); elseif (x <= 443381.0077497065) tmp = 1.0 / ((t_0 + t_1) / ((t_0 ^ 2.0) - (t_1 ^ 2.0))); else tmp = (-3.0 / x) + ((-1.0 / x) / x); end tmp_2 = 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -10731.07214304758], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 443381.0077497065], N[(1.0 / N[(N[(t$95$0 + t$95$1), $MachinePrecision] / N[(N[Power[t$95$0, 2.0], $MachinePrecision] - N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-3.0 / x), $MachinePrecision] + N[(N[(-1.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{x + 1}{x + -1}\\
\mathbf{if}\;x \leq -10731.07214304758:\\
\;\;\;\;\frac{-3}{x} + \left(\frac{-1}{x \cdot x} + \frac{-3}{{x}^{3}}\right)\\
\mathbf{elif}\;x \leq 443381.0077497065:\\
\;\;\;\;\frac{1}{\frac{t_0 + t_1}{{t_0}^{2} - {t_1}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\
\end{array}



Bits error versus x
Results
if x < -10731.0721430475805Initial program 59.2
Taylor expanded in x around inf 0.4
Simplified0.0
if -10731.0721430475805 < x < 443381.007749707Initial program 0.1
Applied egg-rr0.1
if 443381.007749707 < x Initial program 59.5
Applied egg-rr59.5
Taylor expanded in x around inf 0.4
Simplified0.1
Final simplification0.1
herbie shell --seed 2022153
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))