Average Error: 29.5 → 0.3
Time: 9.0s
Precision: binary64
Cost: 8132
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1} \]
\[\begin{array}{l} t_0 := \frac{-1 - x}{x + -1}\\ \mathbf{if}\;\frac{x}{x + 1} + t_0 \leq 2 \cdot 10^{-11}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{x + 1}, x, t_0\right)\\ \end{array} \]
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (/ (- -1.0 x) (+ x -1.0))))
   (if (<= (+ (/ x (+ x 1.0)) t_0) 2e-11)
     (- (/ -3.0 x) (/ (+ 1.0 (/ 3.0 x)) (* x x)))
     (fma (/ 1.0 (+ x 1.0)) x t_0))))
double code(double x) {
	return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
	double t_0 = (-1.0 - x) / (x + -1.0);
	double tmp;
	if (((x / (x + 1.0)) + t_0) <= 2e-11) {
		tmp = (-3.0 / x) - ((1.0 + (3.0 / x)) / (x * x));
	} else {
		tmp = fma((1.0 / (x + 1.0)), x, 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(-1.0 - x) / Float64(x + -1.0))
	tmp = 0.0
	if (Float64(Float64(x / Float64(x + 1.0)) + t_0) <= 2e-11)
		tmp = Float64(Float64(-3.0 / x) - Float64(Float64(1.0 + Float64(3.0 / x)) / Float64(x * x)));
	else
		tmp = fma(Float64(1.0 / Float64(x + 1.0)), x, 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[(-1.0 - x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], 2e-11], N[(N[(-3.0 / x), $MachinePrecision] - N[(N[(1.0 + N[(3.0 / x), $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$0), $MachinePrecision]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
t_0 := \frac{-1 - x}{x + -1}\\
\mathbf{if}\;\frac{x}{x + 1} + t_0 \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{x + 1}, x, t_0\right)\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1))) < 1.99999999999999988e-11

    1. Initial program 59.3

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1} \]
    2. Taylor expanded in x around inf 0.6

      \[\leadsto \color{blue}{-\left(3 \cdot \frac{1}{{x}^{3}} + \left(\frac{1}{{x}^{2}} + 3 \cdot \frac{1}{x}\right)\right)} \]
    3. Simplified0.3

      \[\leadsto \color{blue}{\frac{-1}{x \cdot x} + \left(\frac{-3}{x} + \frac{-3}{{x}^{3}}\right)} \]
      Proof
      (+.f64 (/.f64 -1 (*.f64 x x)) (+.f64 (/.f64 -3 x) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 1)) (*.f64 x x)) (+.f64 (/.f64 -3 x) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (neg.f64 1) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) (+.f64 (/.f64 -3 x) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 1 (pow.f64 x 2)))) (+.f64 (/.f64 -3 x) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 3)) x) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 3 x))) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 3 1)) x)) (/.f64 -3 (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 x)))) (/.f64 -3 (pow.f64 x 3)))): 41 points increase in error, 1 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (Rewrite<= metadata-eval (neg.f64 3)) (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 3 (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (neg.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 3 1)) (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (+.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 11 points increase in error, 9 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (*.f64 3 (/.f64 1 x)) (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (neg.f64 (+.f64 (*.f64 3 (/.f64 1 x)) (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 3 (/.f64 1 x)) (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3)))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (-.f64 (*.f64 3 (/.f64 1 x)) (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (*.f64 3 (/.f64 1 x))) (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (neg.f64 (/.f64 1 (pow.f64 x 2))) (neg.f64 (*.f64 3 (/.f64 1 x))))) (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 x))))) (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3)))) (neg.f64 (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))) (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in x around 0 0.6

      \[\leadsto \color{blue}{-\left(3 \cdot \frac{1}{x} + \left(\frac{1}{{x}^{2}} + 3 \cdot \frac{1}{{x}^{3}}\right)\right)} \]
    5. Simplified0.3

      \[\leadsto \color{blue}{\frac{-3}{x} - \frac{1 - \frac{-3}{x}}{x \cdot x}} \]
      Proof
      (-.f64 (/.f64 -3 x) (/.f64 (-.f64 1 (/.f64 -3 x)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 3)) x) (/.f64 (-.f64 1 (/.f64 -3 x)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 3 x))) (/.f64 (-.f64 1 (/.f64 -3 x)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 3 1)) x)) (/.f64 (-.f64 1 (/.f64 -3 x)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 x)))) (/.f64 (-.f64 1 (/.f64 -3 x)) (*.f64 x x))): 41 points increase in error, 1 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (-.f64 1 (/.f64 (Rewrite<= metadata-eval (neg.f64 3)) x)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (-.f64 1 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 3 x)))) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (-.f64 1 (neg.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 3 1)) x))) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (-.f64 1 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 x))))) (*.f64 x x))): 7 points increase in error, 6 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 1 (neg.f64 (neg.f64 (*.f64 3 (/.f64 1 x)))))) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 1 (Rewrite=> remove-double-neg_binary64 (*.f64 3 (/.f64 1 x)))) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 3 (/.f64 1 x)) 1)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (Rewrite<= unpow1_binary64 (pow.f64 x 1)) x))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (Rewrite=> sqr-pow_binary64 (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (/.f64 1 2)))) x))): 91 points increase in error, 6 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (Rewrite=> associate-*l*_binary64 (*.f64 (pow.f64 x (/.f64 1 2)) (*.f64 (pow.f64 x (/.f64 1 2)) x))))): 1 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (pow.f64 x (/.f64 1 2)) (Rewrite=> pow-plus_binary64 (pow.f64 x (+.f64 (/.f64 1 2) 1)))))): 1 points increase in error, 2 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (+.f64 (Rewrite=> metadata-eval 1/2) 1))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (Rewrite=> metadata-eval 3/2))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (Rewrite<= metadata-eval (/.f64 3 2)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (+.f64 (*.f64 3 (/.f64 1 x)) 1))) (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (/.f64 3 2))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (/.f64 3 2)))) (+.f64 (*.f64 3 (/.f64 1 x)) 1)))): 0 points increase in error, 6 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 1 (pow.f64 x (/.f64 3 2))) (pow.f64 x (/.f64 1 2)))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 3 points increase in error, 1 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 (pow.f64 x (Rewrite=> metadata-eval 3/2))) (pow.f64 x (/.f64 1 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 (pow.f64 x (Rewrite<= metadata-eval (+.f64 1/2 1)))) (pow.f64 x (/.f64 1 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 (pow.f64 x (+.f64 (Rewrite<= metadata-eval (/.f64 1 2)) 1))) (pow.f64 x (/.f64 1 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 (Rewrite<= pow-plus_binary64 (*.f64 (pow.f64 x (/.f64 1 2)) x))) (pow.f64 x (/.f64 1 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 2 points increase in error, 2 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 1 x) (pow.f64 x (/.f64 1 2)))) (pow.f64 x (/.f64 1 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 2 points increase in error, 3 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 (/.f64 1 x) (*.f64 (pow.f64 x (/.f64 1 2)) (pow.f64 x (/.f64 1 2))))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 2 points increase in error, 1 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 x) (Rewrite<= sqr-pow_binary64 (pow.f64 x 1))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 4 points increase in error, 94 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 (/.f64 1 x) (Rewrite=> unpow1_binary64 x)) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 1 (*.f64 x x))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 12 points increase in error, 10 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (*.f64 (/.f64 1 (Rewrite<= unpow2_binary64 (pow.f64 x 2))) (+.f64 (*.f64 3 (/.f64 1 x)) 1))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (Rewrite=> *-commutative_binary64 (*.f64 (+.f64 (*.f64 3 (/.f64 1 x)) 1) (/.f64 1 (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (Rewrite<= distribute-rgt1-in_binary64 (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 (*.f64 3 (/.f64 1 x)) (/.f64 1 (pow.f64 x 2)))))): 1 points increase in error, 2 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (*.f64 3 (/.f64 1 x)) 1) (pow.f64 x 2))))): 10 points increase in error, 5 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (/.f64 (Rewrite=> *-rgt-identity_binary64 (*.f64 3 (/.f64 1 x))) (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 (/.f64 1 x) (pow.f64 x 2)))))): 8 points increase in error, 15 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (Rewrite<= associate-/r*_binary64 (/.f64 1 (*.f64 x (pow.f64 x 2))))))): 10 points increase in error, 5 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 (*.f64 x (Rewrite=> unpow2_binary64 (*.f64 x x))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 (Rewrite<= cube-mult_binary64 (pow.f64 x 3)))))): 4 points increase in error, 5 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (neg.f64 (*.f64 3 (/.f64 1 x))) (neg.f64 (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (*.f64 3 (/.f64 1 x)) (+.f64 (/.f64 1 (pow.f64 x 2)) (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 0 points increase in error, 0 points decrease in error

    if 1.99999999999999988e-11 < (-.f64 (/.f64 x (+.f64 x 1)) (/.f64 (+.f64 x 1) (-.f64 x 1)))

    1. Initial program 0.3

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1} \]
    2. Applied egg-rr0.3

      \[\leadsto \color{blue}{\frac{\frac{x + -1}{x + 1} - \frac{x + 1}{x} \cdot 1}{\frac{x + 1}{x} \cdot \frac{x + -1}{x + 1}}} \]
    3. Applied egg-rr0.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{x + -1}{x + 1}}{x + -1}, x, -\frac{x + 1}{\frac{x + -1}{x} \cdot x}\right)} \]
    4. Taylor expanded in x around 0 0.3

      \[\leadsto \mathsf{fma}\left(\frac{\frac{x + -1}{x + 1}}{x + -1}, x, -\frac{x + 1}{\color{blue}{x - 1}}\right) \]
    5. Applied egg-rr0.3

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{x + 1} \cdot 1}, x, -\frac{x + 1}{x - 1}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{x + 1} + \frac{-1 - x}{x + -1} \leq 2 \cdot 10^{-11}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{x + 1}, x, \frac{-1 - x}{x + -1}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost1732
\[\begin{array}{l} t_0 := \frac{x}{x + 1} + \frac{-1 - x}{x + -1}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-11}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.6
Cost1096
\[\begin{array}{l} t_0 := \frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{if}\;x \leq -5.732353929192063:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.027639669428479896:\\ \;\;\;\;x + \left(x + 1\right) \cdot \left(x + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.7
Cost840
\[\begin{array}{l} t_0 := \frac{-3 + \frac{-1}{x}}{x}\\ \mathbf{if}\;x \leq -5.732353929192063:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.027639669428479896:\\ \;\;\;\;x + \left(x + 1\right) \cdot \left(x + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.8
Cost712
\[\begin{array}{l} t_0 := \frac{-3 + \frac{-1}{x}}{x}\\ \mathbf{if}\;x \leq -5.732353929192063:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.027639669428479896:\\ \;\;\;\;1 + x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error1.1
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5.732353929192063:\\ \;\;\;\;\frac{-3}{x}\\ \mathbf{elif}\;x \leq 0.027639669428479896:\\ \;\;\;\;1 + x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x}\\ \end{array} \]
Alternative 6
Error1.4
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -5.732353929192063:\\ \;\;\;\;\frac{-3}{x}\\ \mathbf{elif}\;x \leq 0.027639669428479896:\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x}\\ \end{array} \]
Alternative 7
Error31.7
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022308 
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))