Average Error: 29.3 → 0.1
Time: 9.7s
Precision: binary64
Cost: 14280
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1} \]
\[\begin{array}{l} \mathbf{if}\;x \leq -16500:\\ \;\;\;\;\frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\ \mathbf{elif}\;x \leq 2700:\\ \;\;\;\;\frac{\frac{x \cdot \left(x + -1\right) - {\left(x + 1\right)}^{2}}{x + 1}}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-1}{{x}^{4}} + \frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x} + \frac{-3}{{x}^{3}}\right)\\ \end{array} \]
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
 :precision binary64
 (if (<= x -16500.0)
   (/ (+ (/ 2.0 (* x x)) (+ 3.0 (/ -2.0 x))) (/ (+ x -1.0) -1.0))
   (if (<= x 2700.0)
     (/ (/ (- (* x (+ x -1.0)) (pow (+ x 1.0) 2.0)) (+ x 1.0)) (+ x -1.0))
     (+
      (+ (/ -1.0 (pow x 4.0)) (/ -1.0 (* x x)))
      (+ (/ -3.0 x) (/ -3.0 (pow x 3.0)))))))
double code(double x) {
	return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
	double tmp;
	if (x <= -16500.0) {
		tmp = ((2.0 / (x * x)) + (3.0 + (-2.0 / x))) / ((x + -1.0) / -1.0);
	} else if (x <= 2700.0) {
		tmp = (((x * (x + -1.0)) - pow((x + 1.0), 2.0)) / (x + 1.0)) / (x + -1.0);
	} else {
		tmp = ((-1.0 / pow(x, 4.0)) + (-1.0 / (x * x))) + ((-3.0 / x) + (-3.0 / pow(x, 3.0)));
	}
	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) :: tmp
    if (x <= (-16500.0d0)) then
        tmp = ((2.0d0 / (x * x)) + (3.0d0 + ((-2.0d0) / x))) / ((x + (-1.0d0)) / (-1.0d0))
    else if (x <= 2700.0d0) then
        tmp = (((x * (x + (-1.0d0))) - ((x + 1.0d0) ** 2.0d0)) / (x + 1.0d0)) / (x + (-1.0d0))
    else
        tmp = (((-1.0d0) / (x ** 4.0d0)) + ((-1.0d0) / (x * x))) + (((-3.0d0) / x) + ((-3.0d0) / (x ** 3.0d0)))
    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 tmp;
	if (x <= -16500.0) {
		tmp = ((2.0 / (x * x)) + (3.0 + (-2.0 / x))) / ((x + -1.0) / -1.0);
	} else if (x <= 2700.0) {
		tmp = (((x * (x + -1.0)) - Math.pow((x + 1.0), 2.0)) / (x + 1.0)) / (x + -1.0);
	} else {
		tmp = ((-1.0 / Math.pow(x, 4.0)) + (-1.0 / (x * x))) + ((-3.0 / x) + (-3.0 / Math.pow(x, 3.0)));
	}
	return tmp;
}
def code(x):
	return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0))
def code(x):
	tmp = 0
	if x <= -16500.0:
		tmp = ((2.0 / (x * x)) + (3.0 + (-2.0 / x))) / ((x + -1.0) / -1.0)
	elif x <= 2700.0:
		tmp = (((x * (x + -1.0)) - math.pow((x + 1.0), 2.0)) / (x + 1.0)) / (x + -1.0)
	else:
		tmp = ((-1.0 / math.pow(x, 4.0)) + (-1.0 / (x * x))) + ((-3.0 / x) + (-3.0 / math.pow(x, 3.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)
	tmp = 0.0
	if (x <= -16500.0)
		tmp = Float64(Float64(Float64(2.0 / Float64(x * x)) + Float64(3.0 + Float64(-2.0 / x))) / Float64(Float64(x + -1.0) / -1.0));
	elseif (x <= 2700.0)
		tmp = Float64(Float64(Float64(Float64(x * Float64(x + -1.0)) - (Float64(x + 1.0) ^ 2.0)) / Float64(x + 1.0)) / Float64(x + -1.0));
	else
		tmp = Float64(Float64(Float64(-1.0 / (x ^ 4.0)) + Float64(-1.0 / Float64(x * x))) + Float64(Float64(-3.0 / x) + Float64(-3.0 / (x ^ 3.0))));
	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)
	tmp = 0.0;
	if (x <= -16500.0)
		tmp = ((2.0 / (x * x)) + (3.0 + (-2.0 / x))) / ((x + -1.0) / -1.0);
	elseif (x <= 2700.0)
		tmp = (((x * (x + -1.0)) - ((x + 1.0) ^ 2.0)) / (x + 1.0)) / (x + -1.0);
	else
		tmp = ((-1.0 / (x ^ 4.0)) + (-1.0 / (x * x))) + ((-3.0 / x) + (-3.0 / (x ^ 3.0)));
	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_] := If[LessEqual[x, -16500.0], N[(N[(N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(3.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x + -1.0), $MachinePrecision] / -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2700.0], N[(N[(N[(N[(x * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-3.0 / x), $MachinePrecision] + N[(-3.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\begin{array}{l}
\mathbf{if}\;x \leq -16500:\\
\;\;\;\;\frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\

\mathbf{elif}\;x \leq 2700:\\
\;\;\;\;\frac{\frac{x \cdot \left(x + -1\right) - {\left(x + 1\right)}^{2}}{x + 1}}{x + -1}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{-1}{{x}^{4}} + \frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x} + \frac{-3}{{x}^{3}}\right)\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -16500

    1. Initial program 59.2

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

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

      \[\leadsto \color{blue}{\frac{\left(1 + x\right) - \frac{x}{\frac{1 + x}{x + -1}}}{\frac{x + -1}{-1}}} \]
      Proof
      (/.f64 (-.f64 (+.f64 1 x) (/.f64 x (/.f64 (+.f64 1 x) (+.f64 x -1)))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 x 1)) (/.f64 x (/.f64 (+.f64 1 x) (+.f64 x -1)))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 x 1) (/.f64 x (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 x 1)) (+.f64 x -1)))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 x 1) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 x (+.f64 x -1)) (+.f64 x 1)))) (/.f64 (+.f64 x -1) -1)): 69 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 x 1) (Rewrite<= associate-*r/_binary64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 2 points increase in error, 69 points decrease in error
      (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (+.f64 x 1) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1)))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (+.f64 x 1)))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 x) (neg.f64 1)))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (+.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 x)) (neg.f64 1))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (+.f64 (*.f64 -1 x) (Rewrite=> metadata-eval -1))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (Rewrite<= fma-udef_binary64 (fma.f64 -1 x -1))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 (fma.f64 -1 x -1) 1))) (neg.f64 (*.f64 x (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 (*.f64 (fma.f64 -1 x -1) 1)) (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1))))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1))) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1)))) (/.f64 (+.f64 x -1) -1)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= fma-udef_binary64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1)))) (/.f64 (+.f64 x -1) -1)): 1 points increase in error, 6 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (Rewrite<= metadata-eval (-.f64 0 1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (-.f64 (Rewrite<= div0_binary64 (/.f64 0 (fma.f64 -1 x -1))) 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (-.f64 (/.f64 0 (fma.f64 -1 x -1)) (Rewrite<= *-inverses_binary64 (/.f64 (fma.f64 -1 x -1) (fma.f64 -1 x -1)))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (Rewrite<= div-sub_binary64 (/.f64 (-.f64 0 (fma.f64 -1 x -1)) (fma.f64 -1 x -1))))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (fma.f64 -1 x -1))) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (neg.f64 (Rewrite=> fma-udef_binary64 (+.f64 (*.f64 -1 x) -1))) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (neg.f64 (+.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 x)) -1)) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (neg.f64 (+.f64 (neg.f64 x) (Rewrite<= metadata-eval (neg.f64 1)))) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (neg.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 x 1)))) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (+.f64 x -1) (/.f64 (Rewrite=> remove-double-neg_binary64 (+.f64 x 1)) (fma.f64 -1 x -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (+.f64 x -1) (fma.f64 -1 x -1)) (+.f64 x 1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (fma.f64 -1 x -1) (+.f64 x -1))) (+.f64 x 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 (neg.f64 x) (/.f64 (+.f64 x -1) (+.f64 x 1)) (neg.f64 (*.f64 (fma.f64 -1 x -1) 1))) (Rewrite<= associate-*r/_binary64 (*.f64 (fma.f64 -1 x -1) (/.f64 (+.f64 x -1) (+.f64 x 1))))): 0 points increase in error, 1 points decrease in error
    4. Taylor expanded in x around inf 0.0

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

      \[\leadsto \frac{\color{blue}{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}}{\frac{x + -1}{-1}} \]
      Proof
      (+.f64 (/.f64 2 (*.f64 x x)) (+.f64 3 (/.f64 -2 x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 2 1)) (*.f64 x x)) (+.f64 3 (/.f64 -2 x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 2 1) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) (+.f64 3 (/.f64 -2 x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 2 (/.f64 1 (pow.f64 x 2)))) (+.f64 3 (/.f64 -2 x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) (+.f64 3 (/.f64 (Rewrite<= metadata-eval (neg.f64 2)) x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) (+.f64 3 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 2 x))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) (+.f64 3 (neg.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 2 1)) x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) (+.f64 3 (neg.f64 (Rewrite<= associate-*r/_binary64 (*.f64 2 (/.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) (Rewrite<= sub-neg_binary64 (-.f64 3 (*.f64 2 (/.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (*.f64 2 (/.f64 1 (pow.f64 x 2))) 3) (*.f64 2 (/.f64 1 x)))): 0 points increase in error, 1 points decrease in error
      (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 3 (*.f64 2 (/.f64 1 (pow.f64 x 2))))) (*.f64 2 (/.f64 1 x))): 0 points increase in error, 0 points decrease in error

    if -16500 < x < 2700

    1. Initial program 0.1

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

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

    if 2700 < x

    1. Initial program 59.2

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

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

      \[\leadsto \color{blue}{-\left(\left(\frac{1}{{x}^{4}} + \frac{1}{x \cdot x}\right) + \left(\frac{3}{x} + \frac{3}{{x}^{3}}\right)\right)} \]
      Proof
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.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
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.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
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.f64 1 (pow.f64 x 2))) (+.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
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.f64 1 (pow.f64 x 2))) (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 x))) (/.f64 3 (pow.f64 x 3))))): 36 points increase in error, 3 points decrease in error
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.f64 1 (pow.f64 x 2))) (+.f64 (*.f64 3 (/.f64 1 x)) (/.f64 (Rewrite<= metadata-eval (*.f64 3 1)) (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.f64 1 (pow.f64 x 2))) (+.f64 (*.f64 3 (/.f64 1 x)) (Rewrite<= associate-*r/_binary64 (*.f64 3 (/.f64 1 (pow.f64 x 3))))))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (+.f64 (+.f64 (/.f64 1 (pow.f64 x 4)) (/.f64 1 (pow.f64 x 2))) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))) (*.f64 3 (/.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (neg.f64 (Rewrite<= associate-+r+_binary64 (+.f64 (/.f64 1 (pow.f64 x 4)) (+.f64 (/.f64 1 (pow.f64 x 2)) (+.f64 (*.f64 3 (/.f64 1 (pow.f64 x 3))) (*.f64 3 (/.f64 1 x))))))): 0 points increase in error, 2 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -16500:\\ \;\;\;\;\frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\ \mathbf{elif}\;x \leq 2700:\\ \;\;\;\;\frac{\frac{x \cdot \left(x + -1\right) - {\left(x + 1\right)}^{2}}{x + 1}}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-1}{{x}^{4}} + \frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x} + \frac{-3}{{x}^{3}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.1
Cost8072
\[\begin{array}{l} t_0 := \frac{2}{x \cdot x}\\ t_1 := \frac{x + -1}{-1}\\ \mathbf{if}\;x \leq -16500:\\ \;\;\;\;\frac{t_0 + \left(3 + \frac{-2}{x}\right)}{t_1}\\ \mathbf{elif}\;x \leq 2100:\\ \;\;\;\;\frac{\frac{x \cdot \left(x + -1\right) - {\left(x + 1\right)}^{2}}{x + 1}}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(t_0 + 3\right) + \left(\frac{-2}{x} + \frac{-2}{{x}^{3}}\right)}{t_1}\\ \end{array} \]
Alternative 2
Error0.1
Cost7560
\[\begin{array}{l} \mathbf{if}\;x \leq -16000:\\ \;\;\;\;\frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\ \mathbf{elif}\;x \leq 21000:\\ \;\;\;\;\frac{\left(x + -1\right) + \left(x + 1\right) \cdot \frac{-1 - x}{x}}{\left(x + -1\right) \cdot \frac{x + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\right) + \frac{-3}{{x}^{3}}\\ \end{array} \]
Alternative 3
Error0.1
Cost1736
\[\begin{array}{l} \mathbf{if}\;x \leq -16000:\\ \;\;\;\;\frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\ \mathbf{elif}\;x \leq 21000:\\ \;\;\;\;\frac{\left(x + -1\right) + \left(x + 1\right) \cdot \frac{-1 - x}{x}}{\left(x + -1\right) \cdot \frac{x + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-3 + \frac{2 + \frac{-2}{x}}{x}}{x + -1}\\ \end{array} \]
Alternative 4
Error0.1
Cost1480
\[\begin{array}{l} t_0 := \frac{x + -1}{-1}\\ t_1 := \frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{t_0}\\ \mathbf{if}\;x \leq -15600:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 15000:\\ \;\;\;\;\frac{x + \left(1 - x \cdot \frac{x + -1}{x + 1}\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.1
Cost1352
\[\begin{array}{l} t_0 := \frac{\frac{2}{x \cdot x} + \left(3 + \frac{-2}{x}\right)}{\frac{x + -1}{-1}}\\ \mathbf{if}\;x \leq -13600:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 13000:\\ \;\;\;\;\frac{x}{x + 1} + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error0.1
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -280000:\\ \;\;\;\;\frac{\frac{2}{x} + -3}{x + -1}\\ \mathbf{elif}\;x \leq 320000:\\ \;\;\;\;\frac{x}{x + 1} + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\ \end{array} \]
Alternative 7
Error0.1
Cost1096
\[\begin{array}{l} t_0 := \frac{-3 + \frac{2 + \frac{-2}{x}}{x}}{x + -1}\\ \mathbf{if}\;x \leq -13600:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 13000:\\ \;\;\;\;\frac{x}{x + 1} + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error0.8
Cost840
\[\begin{array}{l} t_0 := \frac{1}{x \cdot -0.3333333333333333 + 0.1111111111111111}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;x + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error0.7
Cost840
\[\begin{array}{l} t_0 := \frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.75:\\ \;\;\;\;x + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error0.7
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{-3 \cdot \frac{x + 0.3333333333333333}{x}}{x}\\ \mathbf{elif}\;x \leq 1.75:\\ \;\;\;\;x + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x} + \frac{\frac{-1}{x}}{x}\\ \end{array} \]
Alternative 11
Error0.7
Cost840
\[\begin{array}{l} t_0 := \frac{\frac{2}{x} + -3}{x + -1}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.55:\\ \;\;\;\;x + \frac{-1 - x}{x + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error0.8
Cost712
\[\begin{array}{l} t_0 := \frac{1}{x \cdot -0.3333333333333333 + 0.1111111111111111}\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1 + x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error1.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{-3}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1 + x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x}\\ \end{array} \]
Alternative 14
Error1.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{-3}{x}\\ \mathbf{elif}\;x \leq 0.65:\\ \;\;\;\;1 + x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x + -1}\\ \end{array} \]
Alternative 15
Error1.3
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{-3}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{x}\\ \end{array} \]
Alternative 16
Error31.5
Cost64
\[1 \]

Error

Reproduce

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