(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(if (<= x -60568178728272.734)
(expm1 (log1p (/ (+ -3.0 (/ 2.0 x)) (+ x -1.0))))
(if (<= x 0.3392509774779934)
(expm1
(log1p
(/ (fma x (/ (+ x -1.0) (+ x 1.0)) (fma -1.0 x -1.0)) (+ x -1.0))))
(expm1 (log1p (+ (/ -1.0 (* x x)) (/ -3.0 x)))))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double tmp;
if (x <= -60568178728272.734) {
tmp = expm1(log1p(((-3.0 + (2.0 / x)) / (x + -1.0))));
} else if (x <= 0.3392509774779934) {
tmp = expm1(log1p((fma(x, ((x + -1.0) / (x + 1.0)), fma(-1.0, x, -1.0)) / (x + -1.0))));
} else {
tmp = expm1(log1p(((-1.0 / (x * x)) + (-3.0 / 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) tmp = 0.0 if (x <= -60568178728272.734) tmp = expm1(log1p(Float64(Float64(-3.0 + Float64(2.0 / x)) / Float64(x + -1.0)))); elseif (x <= 0.3392509774779934) tmp = expm1(log1p(Float64(fma(x, Float64(Float64(x + -1.0) / Float64(x + 1.0)), fma(-1.0, x, -1.0)) / Float64(x + -1.0)))); else tmp = expm1(log1p(Float64(Float64(-1.0 / Float64(x * x)) + Float64(-3.0 / x)))); 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_] := If[LessEqual[x, -60568178728272.734], N[(Exp[N[Log[1 + N[(N[(-3.0 + N[(2.0 / x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], If[LessEqual[x, 0.3392509774779934], N[(Exp[N[Log[1 + N[(N[(x * N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], N[(Exp[N[Log[1 + N[(N[(-1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-3.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \leq -60568178728272.734:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-3 + \frac{2}{x}}{x + -1}\right)\right)\\
\mathbf{elif}\;x \leq 0.3392509774779934:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\mathsf{fma}\left(x, \frac{x + -1}{x + 1}, \mathsf{fma}\left(-1, x, -1\right)\right)}{x + -1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-1}{x \cdot x} + \frac{-3}{x}\right)\right)\\
\end{array}
if x < -60568178728272.734Initial program 60.3
Applied egg-rr60.3
Applied egg-rr60.3
Taylor expanded in x around inf 0.0
Simplified0.0
if -60568178728272.734 < x < 0.33925097747799338Initial program 0.4
Applied egg-rr0.4
Applied egg-rr0.4
if 0.33925097747799338 < x Initial program 58.9
Applied egg-rr58.8
Applied egg-rr58.9
Taylor expanded in x around inf 0.9
Simplified0.6
Final simplification0.4
herbie shell --seed 2022185
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))