Average Error: 20.2 → 0.2
Time: 11.1s
Precision: binary64
Cost: 26756
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\begin{array}{l} t_0 := \sqrt{1 + x}\\ \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 2 \cdot 10^{-10}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \frac{1}{t_0}\\ \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ 1.0 x))))
   (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 t_0)) 2e-10)
     (* (/ (pow x -0.5) x) (+ 0.5 (+ (/ 0.3125 (* x x)) (/ -0.375 x))))
     (- (pow x -0.5) (/ 1.0 t_0)))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
double code(double x) {
	double t_0 = sqrt((1.0 + x));
	double tmp;
	if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 2e-10) {
		tmp = (pow(x, -0.5) / x) * (0.5 + ((0.3125 / (x * x)) + (-0.375 / x)));
	} else {
		tmp = pow(x, -0.5) - (1.0 / t_0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((1.0d0 + x))
    if (((1.0d0 / sqrt(x)) + ((-1.0d0) / t_0)) <= 2d-10) then
        tmp = ((x ** (-0.5d0)) / x) * (0.5d0 + ((0.3125d0 / (x * x)) + ((-0.375d0) / x)))
    else
        tmp = (x ** (-0.5d0)) - (1.0d0 / t_0)
    end if
    code = tmp
end function
public static double code(double x) {
	return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
public static double code(double x) {
	double t_0 = Math.sqrt((1.0 + x));
	double tmp;
	if (((1.0 / Math.sqrt(x)) + (-1.0 / t_0)) <= 2e-10) {
		tmp = (Math.pow(x, -0.5) / x) * (0.5 + ((0.3125 / (x * x)) + (-0.375 / x)));
	} else {
		tmp = Math.pow(x, -0.5) - (1.0 / t_0);
	}
	return tmp;
}
def code(x):
	return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
def code(x):
	t_0 = math.sqrt((1.0 + x))
	tmp = 0
	if ((1.0 / math.sqrt(x)) + (-1.0 / t_0)) <= 2e-10:
		tmp = (math.pow(x, -0.5) / x) * (0.5 + ((0.3125 / (x * x)) + (-0.375 / x)))
	else:
		tmp = math.pow(x, -0.5) - (1.0 / t_0)
	return tmp
function code(x)
	return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
function code(x)
	t_0 = sqrt(Float64(1.0 + x))
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / t_0)) <= 2e-10)
		tmp = Float64(Float64((x ^ -0.5) / x) * Float64(0.5 + Float64(Float64(0.3125 / Float64(x * x)) + Float64(-0.375 / x))));
	else
		tmp = Float64((x ^ -0.5) - Float64(1.0 / t_0));
	end
	return tmp
end
function tmp = code(x)
	tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
function tmp_2 = code(x)
	t_0 = sqrt((1.0 + x));
	tmp = 0.0;
	if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 2e-10)
		tmp = ((x ^ -0.5) / x) * (0.5 + ((0.3125 / (x * x)) + (-0.375 / x)));
	else
		tmp = (x ^ -0.5) - (1.0 / t_0);
	end
	tmp_2 = tmp;
end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 2e-10], N[(N[(N[Power[x, -0.5], $MachinePrecision] / x), $MachinePrecision] * N[(0.5 + N[(N[(0.3125 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.375 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{t_0}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.2
Target0.6
Herbie0.2
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2.00000000000000007e-10

    1. Initial program 40.3

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}}\right)}^{3}} \]
    3. Applied egg-rr40.2

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}} \]
    4. Taylor expanded in x around -inf 64.0

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

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)} \]
      Proof
      (*.f64 (/.f64 (pow.f64 x -1/2) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= exp-to-pow_binary64 (exp.f64 (*.f64 (log.f64 x) -1/2))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 100 points increase in error, 18 points decrease in error
      (*.f64 (/.f64 (exp.f64 (Rewrite<= *-commutative_binary64 (*.f64 -1/2 (log.f64 x)))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite=> exp-prod_binary64 (pow.f64 (exp.f64 -1/2) (log.f64 x))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 32 points increase in error, 53 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (Rewrite<= +-lft-identity_binary64 (+.f64 0 (log.f64 x)))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (+.f64 (Rewrite<= +-inverses_binary64 (-.f64 (log.f64 -1) (log.f64 -1))) (log.f64 x))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 176 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (Rewrite<= associate--r-_binary64 (-.f64 (log.f64 -1) (-.f64 (log.f64 -1) (log.f64 x))))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (-.f64 (log.f64 -1) (Rewrite<= log-div_binary64 (log.f64 (/.f64 -1 x))))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (Rewrite<= unsub-neg_binary64 (+.f64 (log.f64 -1) (neg.f64 (log.f64 (/.f64 -1 x)))))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (+.f64 (log.f64 -1) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (log.f64 (/.f64 -1 x)))))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (exp.f64 -1/2) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= exp-prod_binary64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (*.f64 x x)) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) (+.f64 1/2 (+.f64 (/.f64 5/16 (Rewrite<= unpow2_binary64 (pow.f64 x 2))) (/.f64 -3/8 x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) (+.f64 1/2 (Rewrite=> +-commutative_binary64 (+.f64 (/.f64 -3/8 x) (/.f64 5/16 (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-lft-out_binary64 (+.f64 (*.f64 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) 1/2) (*.f64 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) (+.f64 (/.f64 -3/8 x) (/.f64 5/16 (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x))) (*.f64 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x) (+.f64 (/.f64 -3/8 x) (/.f64 5/16 (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 (/.f64 -3/8 x) (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (*.f64 (/.f64 5/16 (pow.f64 x 2)) (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -3/8 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) (*.f64 x x))) (*.f64 (/.f64 5/16 (pow.f64 x 2)) (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (/.f64 (*.f64 -3/8 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) (*.f64 (/.f64 5/16 (pow.f64 x 2)) (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2)))) (*.f64 (/.f64 5/16 (pow.f64 x 2)) (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2))) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 5/16 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) (*.f64 (pow.f64 x 2) x))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2))) (/.f64 (*.f64 5/16 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) (*.f64 (Rewrite=> unpow2_binary64 (*.f64 x x)) x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2))) (/.f64 (*.f64 5/16 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1))))) (Rewrite<= unpow3_binary64 (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (+.f64 (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2))) (Rewrite<= associate-*r/_binary64 (*.f64 5/16 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 3)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2)))) (*.f64 5/16 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 3))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 5/16 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 3))) (+.f64 (*.f64 1/2 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) x)) (*.f64 -3/8 (/.f64 (exp.f64 (*.f64 -1/2 (+.f64 (*.f64 -1 (log.f64 (/.f64 -1 x))) (log.f64 -1)))) (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error

    if 2.00000000000000007e-10 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 0.5

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

      \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-10}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \frac{1}{\sqrt{1 + x}}\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost13696
\[\frac{\frac{1}{x \cdot {\left(1 + x\right)}^{-0.5} + \sqrt{x}}}{1 + x} \]
Alternative 2
Error0.2
Cost13380
\[\begin{array}{l} \mathbf{if}\;x \leq 3565.0193008744304:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\ \end{array} \]
Alternative 3
Error0.7
Cost7556
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\ \end{array} \]
Alternative 4
Error0.6
Cost7556
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} - \left(1 + x \cdot \left(-0.5 + x \cdot \left(0.375 + x \cdot -0.3125\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \left(\frac{0.3125}{x \cdot x} + \frac{-0.375}{x}\right)\right)\\ \end{array} \]
Alternative 5
Error0.8
Cost7172
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} - \left(1 + x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \frac{-0.375}{x}\right)\\ \end{array} \]
Alternative 6
Error0.8
Cost7172
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x} \cdot \left(0.5 + \frac{-0.375}{x}\right)\\ \end{array} \]
Alternative 7
Error1.1
Cost7108
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} - \left(1 + x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \sqrt{\frac{1}{x}}}{1 + x}\\ \end{array} \]
Alternative 8
Error1.2
Cost7044
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} - \left(1 + x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\ \end{array} \]
Alternative 9
Error1.3
Cost6916
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} \cdot \frac{0.5}{x}\\ \end{array} \]
Alternative 10
Error30.5
Cost6788
\[\begin{array}{l} \mathbf{if}\;x \leq 0.01133269418342468:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} + \frac{-0.5}{x \cdot x}\\ \end{array} \]
Alternative 11
Error30.8
Cost6720
\[\frac{1}{x + \sqrt{x}} \]
Alternative 12
Error32.1
Cost6528
\[{x}^{-0.5} \]
Alternative 13
Error59.2
Cost320
\[\frac{1}{x + 0.5} \]
Alternative 14
Error59.3
Cost192
\[\frac{1}{x} \]
Alternative 15
Error62.8
Cost64
\[-1 \]

Error

Reproduce

herbie shell --seed 2022306 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64

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

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))