Average Error: 14.5 → 0.0
Time: 2.3s
Precision: binary64
Cost: 7048
\[\frac{x}{x \cdot x + 1} \]
\[\begin{array}{l} t_0 := \frac{1 - {x}^{-2}}{x}\\ \mathbf{if}\;x \leq -1000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 100:\\ \;\;\;\;\frac{x}{1 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (/ (- 1.0 (pow x -2.0)) x)))
   (if (<= x -1000000.0) t_0 (if (<= x 100.0) (/ x (+ 1.0 (* x x))) t_0))))
double code(double x) {
	return x / ((x * x) + 1.0);
}
double code(double x) {
	double t_0 = (1.0 - pow(x, -2.0)) / x;
	double tmp;
	if (x <= -1000000.0) {
		tmp = t_0;
	} else if (x <= 100.0) {
		tmp = x / (1.0 + (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x / ((x * x) + 1.0d0)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 - (x ** (-2.0d0))) / x
    if (x <= (-1000000.0d0)) then
        tmp = t_0
    else if (x <= 100.0d0) then
        tmp = x / (1.0d0 + (x * x))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x) {
	return x / ((x * x) + 1.0);
}
public static double code(double x) {
	double t_0 = (1.0 - Math.pow(x, -2.0)) / x;
	double tmp;
	if (x <= -1000000.0) {
		tmp = t_0;
	} else if (x <= 100.0) {
		tmp = x / (1.0 + (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x):
	return x / ((x * x) + 1.0)
def code(x):
	t_0 = (1.0 - math.pow(x, -2.0)) / x
	tmp = 0
	if x <= -1000000.0:
		tmp = t_0
	elif x <= 100.0:
		tmp = x / (1.0 + (x * x))
	else:
		tmp = t_0
	return tmp
function code(x)
	return Float64(x / Float64(Float64(x * x) + 1.0))
end
function code(x)
	t_0 = Float64(Float64(1.0 - (x ^ -2.0)) / x)
	tmp = 0.0
	if (x <= -1000000.0)
		tmp = t_0;
	elseif (x <= 100.0)
		tmp = Float64(x / Float64(1.0 + Float64(x * x)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp = code(x)
	tmp = x / ((x * x) + 1.0);
end
function tmp_2 = code(x)
	t_0 = (1.0 - (x ^ -2.0)) / x;
	tmp = 0.0;
	if (x <= -1000000.0)
		tmp = t_0;
	elseif (x <= 100.0)
		tmp = x / (1.0 + (x * x));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_] := N[(x / N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(N[(1.0 - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -1000000.0], t$95$0, If[LessEqual[x, 100.0], N[(x / N[(1.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
t_0 := \frac{1 - {x}^{-2}}{x}\\
\mathbf{if}\;x \leq -1000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 100:\\
\;\;\;\;\frac{x}{1 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.5
Target0.1
Herbie0.0
\[\frac{1}{x + \frac{1}{x}} \]

Derivation

  1. Split input into 2 regimes
  2. if x < -1e6 or 100 < x

    1. Initial program 29.6

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

      \[\leadsto \color{blue}{\frac{1}{x} - \frac{1}{{x}^{3}}} \]
    3. Applied egg-rr0.0

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

      \[\leadsto \color{blue}{\frac{1 - {x}^{-2}}{x}} \]
      Proof
      (/.f64 (-.f64 1 (pow.f64 x -2)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (Rewrite<= *-inverses_binary64 (/.f64 (pow.f64 x 3) (pow.f64 x 3))) (pow.f64 x -2)) x): 86 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (pow.f64 x 3) (Rewrite=> cube-mult_binary64 (*.f64 x (*.f64 x x)))) (pow.f64 x -2)) x): 7 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x))) (pow.f64 x -2)) x): 6 points increase in error, 5 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (pow.f64 x (Rewrite<= metadata-eval (*.f64 2 -1)))) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 x -1) (pow.f64 x -1)))) x): 7 points increase in error, 9 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (*.f64 (Rewrite=> unpow-1_binary64 (/.f64 1 x)) (pow.f64 x -1))) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (*.f64 (/.f64 1 x) (Rewrite=> unpow-1_binary64 (/.f64 1 x)))) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 1 (/.f64 1 x)) x))) x): 6 points increase in error, 1 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (/.f64 (Rewrite=> *-lft-identity_binary64 (/.f64 1 x)) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (/.f64 (/.f64 (pow.f64 x 3) x) (*.f64 x x)) (Rewrite=> associate-/l/_binary64 (/.f64 1 (*.f64 x x)))) x): 3 points increase in error, 10 points decrease in error
      (/.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (/.f64 (pow.f64 x 3) x) 1) (*.f64 x x))) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (-.f64 (/.f64 (pow.f64 x 3) x) (Rewrite<= *-inverses_binary64 (/.f64 x x))) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (pow.f64 x 3) x) x)) (*.f64 x x)) x): 0 points increase in error, 1 points decrease in error
      (/.f64 (Rewrite=> associate-/l/_binary64 (/.f64 (-.f64 (pow.f64 x 3) x) (*.f64 (*.f64 x x) x))) x): 14 points increase in error, 11 points decrease in error
      (/.f64 (/.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 (-.f64 (pow.f64 x 3) x) 1)) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (pow.f64 x 3) x) (Rewrite<= metadata-eval (/.f64 -1 -1))) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 (pow.f64 x 3) x) -1) -1)) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 (-.f64 (pow.f64 x 3) x))) -1) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (Rewrite<= distribute-rgt-out--_binary64 (-.f64 (*.f64 (pow.f64 x 3) -1) (*.f64 x -1))) -1) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1 (pow.f64 x 3))) (*.f64 x -1)) -1) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (pow.f64 x 3))) (*.f64 x -1)) -1) (*.f64 (*.f64 x x) x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 x -1)) -1) x) (*.f64 x x))) x): 11 points increase in error, 14 points decrease in error
      (/.f64 (/.f64 (Rewrite<= associate-/r*_binary64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 x -1)) (*.f64 -1 x))) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (Rewrite=> *-commutative_binary64 (*.f64 -1 x))) (*.f64 -1 x)) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (Rewrite<= neg-mul-1_binary64 (neg.f64 x))) (*.f64 -1 x)) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (Rewrite<= *-rgt-identity_binary64 (*.f64 (neg.f64 x) 1))) (*.f64 -1 x)) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (/.f64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) 1)) (Rewrite<= neg-mul-1_binary64 (neg.f64 x))) (*.f64 x x)) x): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r*_binary64 (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) 1)) (neg.f64 x)) (*.f64 (*.f64 x x) x))): 22 points increase in error, 12 points decrease in error
      (/.f64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) 1)) (neg.f64 x)) (Rewrite<= unpow3_binary64 (pow.f64 x 3))): 6 points increase in error, 11 points decrease in error
      (Rewrite<= associate-/r*_binary64 (/.f64 (-.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) 1)) (*.f64 (neg.f64 x) (pow.f64 x 3)))): 27 points increase in error, 14 points decrease in error
      (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (*.f64 (neg.f64 x) 1) (*.f64 (neg.f64 x) (pow.f64 x 3))))): 1 points increase in error, 2 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (Rewrite=> *-rgt-identity_binary64 (neg.f64 x)) (*.f64 (neg.f64 x) (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 x)) (*.f64 (neg.f64 x) (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 x -1)) (*.f64 (neg.f64 x) (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (*.f64 x -1) (Rewrite=> distribute-lft-neg-out_binary64 (neg.f64 (*.f64 x (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (*.f64 (neg.f64 x) (pow.f64 x 3))) (/.f64 (*.f64 x -1) (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 x (neg.f64 (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (Rewrite=> distribute-lft-neg-out_binary64 (neg.f64 (*.f64 x (pow.f64 x 3))))) (/.f64 (*.f64 x -1) (*.f64 x (neg.f64 (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (Rewrite<= distribute-rgt-neg-out_binary64 (*.f64 x (neg.f64 (pow.f64 x 3))))) (/.f64 (*.f64 x -1) (*.f64 x (neg.f64 (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 (neg.f64 (pow.f64 x 3)) (neg.f64 (pow.f64 x 3))) x)) (/.f64 (*.f64 x -1) (*.f64 x (neg.f64 (pow.f64 x 3))))): 1 points increase in error, 11 points decrease in error
      (-.f64 (/.f64 (Rewrite=> *-inverses_binary64 1) x) (/.f64 (*.f64 x -1) (*.f64 x (neg.f64 (pow.f64 x 3))))): 0 points increase in error, 86 points decrease in error
      (-.f64 (/.f64 1 x) (/.f64 (*.f64 x -1) (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 x (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (/.f64 (*.f64 x -1) (Rewrite<= distribute-lft-neg-out_binary64 (*.f64 (neg.f64 x) (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 -1 x)) (*.f64 (neg.f64 x) (pow.f64 x 3)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (Rewrite=> associate-/l*_binary64 (/.f64 -1 (/.f64 (*.f64 (neg.f64 x) (pow.f64 x 3)) x)))): 4 points increase in error, 3 points decrease in error
      (-.f64 (/.f64 1 x) (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 -1 (*.f64 (neg.f64 x) (pow.f64 x 3))) x))): 8 points increase in error, 6 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (Rewrite<= metadata-eval (/.f64 1 -1)) (*.f64 (neg.f64 x) (pow.f64 x 3))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 1 (*.f64 -1 (*.f64 (neg.f64 x) (pow.f64 x 3))))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 1 (Rewrite<= neg-mul-1_binary64 (neg.f64 (*.f64 (neg.f64 x) (pow.f64 x 3))))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 1 (neg.f64 (Rewrite=> distribute-lft-neg-out_binary64 (neg.f64 (*.f64 x (pow.f64 x 3)))))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 1 (Rewrite=> remove-double-neg_binary64 (*.f64 x (pow.f64 x 3)))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 1 x) (pow.f64 x 3))) x)): 3 points increase in error, 5 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (/.f64 1 x))) (pow.f64 x 3)) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (Rewrite=> unpow3_binary64 (*.f64 (*.f64 x x) x))) x)): 5 points increase in error, 2 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (*.f64 (*.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 x 1)) x) x)) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (*.f64 (Rewrite<= associate-/r/_binary64 (/.f64 x (/.f64 1 x))) x)) x)): 0 points increase in error, 1 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (Rewrite<= associate-/r/_binary64 (/.f64 x (/.f64 (/.f64 1 x) x)))) x)): 3 points increase in error, 4 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (/.f64 1 x))) x))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 x) (/.f64 1 x))))) x)): 1 points increase in error, 4 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (*.f64 (Rewrite<= unpow-1_binary64 (pow.f64 x -1)) (/.f64 1 x)))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (*.f64 (pow.f64 x -1) (Rewrite<= unpow-1_binary64 (pow.f64 x -1))))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (Rewrite=> pow-sqr_binary64 (pow.f64 x (*.f64 2 -1))))) x)): 4 points increase in error, 5 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (/.f64 (*.f64 1 (/.f64 1 x)) (/.f64 x (pow.f64 x (Rewrite=> metadata-eval -2)))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 (/.f64 x (pow.f64 x -2))) (/.f64 1 x))) x)): 3 points increase in error, 2 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 1 x) (pow.f64 x -2))) (/.f64 1 x)) x)): 4 points increase in error, 1 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 x -2) (/.f64 1 x))) (/.f64 1 x)) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (Rewrite<= associate-*r*_binary64 (*.f64 (pow.f64 x -2) (*.f64 (/.f64 1 x) (/.f64 1 x)))) x)): 4 points increase in error, 3 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (pow.f64 x -2) (*.f64 (Rewrite<= unpow-1_binary64 (pow.f64 x -1)) (/.f64 1 x))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (pow.f64 x -2) (*.f64 (pow.f64 x -1) (Rewrite<= unpow-1_binary64 (pow.f64 x -1)))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (pow.f64 x -2) (Rewrite=> pow-sqr_binary64 (pow.f64 x (*.f64 2 -1)))) x)): 5 points increase in error, 6 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (*.f64 (pow.f64 x -2) (pow.f64 x (Rewrite=> metadata-eval -2))) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (Rewrite=> pow-sqr_binary64 (pow.f64 x (*.f64 2 -2))) x)): 7 points increase in error, 4 points decrease in error
      (-.f64 (/.f64 1 x) (*.f64 (pow.f64 x (Rewrite=> metadata-eval -4)) x)): 0 points increase in error, 0 points decrease in error
      (-.f64 (/.f64 1 x) (Rewrite=> pow-plus_binary64 (pow.f64 x (+.f64 -4 1)))): 7 points increase in error, 16 points decrease in error
      (-.f64 (/.f64 1 x) (pow.f64 x (Rewrite=> metadata-eval -3))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 1 x) (neg.f64 (pow.f64 x -3)))): 0 points increase in error, 0 points decrease in error

    if -1e6 < x < 100

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1000000:\\ \;\;\;\;\frac{1 - {x}^{-2}}{x}\\ \mathbf{elif}\;x \leq 100:\\ \;\;\;\;\frac{x}{1 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - {x}^{-2}}{x}\\ \end{array} \]

Alternatives

Alternative 1
Error0.0
Cost13376
\[\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)} \]
Alternative 2
Error0.6
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -0.85:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 0.86:\\ \;\;\;\;x \cdot \left(1 - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 3
Error0.0
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+25}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 95000000:\\ \;\;\;\;\frac{x}{1 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 4
Error0.7
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 5
Error31.0
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022329 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ x (/ 1.0 x)))

  (/ x (+ (* x x) 1.0)))