2isqrt (example 3.6)

?

Percentage Accurate: 69.0% → 83.7%
Time: 20.1s
Precision: binary64
Cost: 66372

?

\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-8}:\\ \;\;\;\;0.3125 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.2734375 \cdot \sqrt{\frac{1}{{x}^{9}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \frac{{\left(1 + x\right)}^{-0.16666666666666666}}{\sqrt[3]{1 + x}}\\ \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ 1.0 x)))) 5e-8)
   (+
    (* 0.3125 (sqrt (/ 1.0 (pow x 7.0))))
    (+
     (* 0.5 (sqrt (/ 1.0 (pow x 3.0))))
     (+
      (* -0.2734375 (sqrt (/ 1.0 (pow x 9.0))))
      (* -0.375 (sqrt (/ 1.0 (pow x 5.0)))))))
   (- (pow x -0.5) (/ (pow (+ 1.0 x) -0.16666666666666666) (cbrt (+ 1.0 x))))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
double code(double x) {
	double tmp;
	if (((1.0 / sqrt(x)) - (1.0 / sqrt((1.0 + x)))) <= 5e-8) {
		tmp = (0.3125 * sqrt((1.0 / pow(x, 7.0)))) + ((0.5 * sqrt((1.0 / pow(x, 3.0)))) + ((-0.2734375 * sqrt((1.0 / pow(x, 9.0)))) + (-0.375 * sqrt((1.0 / pow(x, 5.0))))));
	} else {
		tmp = pow(x, -0.5) - (pow((1.0 + x), -0.16666666666666666) / cbrt((1.0 + x)));
	}
	return tmp;
}
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 tmp;
	if (((1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((1.0 + x)))) <= 5e-8) {
		tmp = (0.3125 * Math.sqrt((1.0 / Math.pow(x, 7.0)))) + ((0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)))) + ((-0.2734375 * Math.sqrt((1.0 / Math.pow(x, 9.0)))) + (-0.375 * Math.sqrt((1.0 / Math.pow(x, 5.0))))));
	} else {
		tmp = Math.pow(x, -0.5) - (Math.pow((1.0 + x), -0.16666666666666666) / Math.cbrt((1.0 + x)));
	}
	return tmp;
}
function code(x)
	return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
function code(x)
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(1.0 + x)))) <= 5e-8)
		tmp = Float64(Float64(0.3125 * sqrt(Float64(1.0 / (x ^ 7.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0)))) + Float64(Float64(-0.2734375 * sqrt(Float64(1.0 / (x ^ 9.0)))) + Float64(-0.375 * sqrt(Float64(1.0 / (x ^ 5.0)))))));
	else
		tmp = Float64((x ^ -0.5) - Float64((Float64(1.0 + x) ^ -0.16666666666666666) / cbrt(Float64(1.0 + x))));
	end
	return 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_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-8], N[(N[(0.3125 * N[Sqrt[N[(1.0 / N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.2734375 * N[Sqrt[N[(1.0 / N[Power[x, 9.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[Sqrt[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[(N[Power[N[(1.0 + x), $MachinePrecision], -0.16666666666666666], $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-8}:\\
\;\;\;\;0.3125 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.2734375 \cdot \sqrt{\frac{1}{{x}^{9}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \frac{{\left(1 + x\right)}^{-0.16666666666666666}}{\sqrt[3]{1 + x}}\\


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 12 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original69.0%
Target99.0%
Herbie83.7%
\[\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)))) < 4.9999999999999998e-8

    1. Initial program 40.1%

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
      Step-by-step derivation

      [Start]40.1%

      \[ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]

      *-un-lft-identity [=>]40.1%

      \[ \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]

      clear-num [=>]40.1%

      \[ 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]

      associate-/r/ [=>]40.1%

      \[ 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]

      prod-diff [=>]40.1%

      \[ \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]

      *-un-lft-identity [<=]40.1%

      \[ \mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -\color{blue}{\frac{1}{\sqrt{x + 1}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      fma-neg [<=]40.1%

      \[ \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      *-un-lft-identity [<=]40.1%

      \[ \left(\color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      inv-pow [=>]40.1%

      \[ \left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      sqrt-pow2 [=>]32.2%

      \[ \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      metadata-eval [=>]32.2%

      \[ \left({x}^{\color{blue}{-0.5}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      pow1/2 [=>]32.2%

      \[ \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      pow-flip [=>]40.1%

      \[ \left({x}^{-0.5} - \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      +-commutative [=>]40.1%

      \[ \left({x}^{-0.5} - {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      metadata-eval [=>]40.1%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{\color{blue}{-0.5}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    3. Simplified40.1%

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
      Step-by-step derivation

      [Start]40.1%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) \]

      fma-udef [=>]40.1%

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

      distribute-lft1-in [=>]40.1%

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

      metadata-eval [=>]40.1%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5} \]

      mul0-lft [=>]40.1%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \]

      +-rgt-identity [=>]40.1%

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

      \[\leadsto \color{blue}{0.3125 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.2734375 \cdot \sqrt{\frac{1}{{x}^{9}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)\right)} \]

    if 4.9999999999999998e-8 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
      Step-by-step derivation

      [Start]99.5%

      \[ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]

      *-un-lft-identity [=>]99.5%

      \[ \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]

      clear-num [=>]99.5%

      \[ 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]

      associate-/r/ [=>]99.5%

      \[ 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]

      prod-diff [=>]99.5%

      \[ \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]

      *-un-lft-identity [<=]99.5%

      \[ \mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -\color{blue}{\frac{1}{\sqrt{x + 1}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      fma-neg [<=]99.5%

      \[ \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      *-un-lft-identity [<=]99.5%

      \[ \left(\color{blue}{\frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      inv-pow [=>]99.5%

      \[ \left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      sqrt-pow2 [=>]99.9%

      \[ \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      metadata-eval [=>]99.9%

      \[ \left({x}^{\color{blue}{-0.5}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      pow1/2 [=>]99.9%

      \[ \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      pow-flip [=>]100.0%

      \[ \left({x}^{-0.5} - \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      +-commutative [=>]100.0%

      \[ \left({x}^{-0.5} - {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]

      metadata-eval [=>]100.0%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{\color{blue}{-0.5}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
      Step-by-step derivation

      [Start]100.0%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) \]

      fma-udef [=>]100.0%

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

      distribute-lft1-in [=>]100.0%

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

      metadata-eval [=>]100.0%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5} \]

      mul0-lft [=>]100.0%

      \[ \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \]

      +-rgt-identity [=>]100.0%

      \[ \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
    4. Applied egg-rr100.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left(x + 1\right)}^{-0.16666666666666666} \cdot \frac{1}{\sqrt[3]{x + 1}}} \]
      Step-by-step derivation

      [Start]100.0%

      \[ {x}^{-0.5} - {\left(1 + x\right)}^{-0.5} \]

      add-cube-cbrt [=>]99.9%

      \[ {x}^{-0.5} - \color{blue}{\left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right) \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}} \]

      associate-*l* [=>]99.9%

      \[ {x}^{-0.5} - \color{blue}{\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right)} \]

      pow1/3 [=>]99.9%

      \[ {x}^{-0.5} - \color{blue}{{\left({\left(1 + x\right)}^{-0.5}\right)}^{0.3333333333333333}} \cdot \left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right) \]

      pow-pow [=>]99.9%

      \[ {x}^{-0.5} - \color{blue}{{\left(1 + x\right)}^{\left(-0.5 \cdot 0.3333333333333333\right)}} \cdot \left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right) \]

      +-commutative [=>]99.9%

      \[ {x}^{-0.5} - {\color{blue}{\left(x + 1\right)}}^{\left(-0.5 \cdot 0.3333333333333333\right)} \cdot \left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right) \]

      metadata-eval [=>]99.9%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{\color{blue}{-0.16666666666666666}} \cdot \left(\sqrt[3]{{\left(1 + x\right)}^{-0.5}} \cdot \sqrt[3]{{\left(1 + x\right)}^{-0.5}}\right) \]

      cbrt-unprod [=>]99.9%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \color{blue}{\sqrt[3]{{\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}} \]

      pow-prod-up [=>]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \sqrt[3]{\color{blue}{{\left(1 + x\right)}^{\left(-0.5 + -0.5\right)}}} \]

      metadata-eval [=>]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \sqrt[3]{{\left(1 + x\right)}^{\color{blue}{-1}}} \]

      inv-pow [<=]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \sqrt[3]{\color{blue}{\frac{1}{1 + x}}} \]

      cbrt-div [=>]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \color{blue}{\frac{\sqrt[3]{1}}{\sqrt[3]{1 + x}}} \]

      metadata-eval [=>]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \frac{\color{blue}{1}}{\sqrt[3]{1 + x}} \]

      +-commutative [=>]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \frac{1}{\sqrt[3]{\color{blue}{x + 1}}} \]
    5. Simplified100.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{\frac{{\left(x + 1\right)}^{-0.16666666666666666}}{\sqrt[3]{x + 1}}} \]
      Step-by-step derivation

      [Start]100.0%

      \[ {x}^{-0.5} - {\left(x + 1\right)}^{-0.16666666666666666} \cdot \frac{1}{\sqrt[3]{x + 1}} \]

      associate-*r/ [=>]100.0%

      \[ {x}^{-0.5} - \color{blue}{\frac{{\left(x + 1\right)}^{-0.16666666666666666} \cdot 1}{\sqrt[3]{x + 1}}} \]

      *-rgt-identity [=>]100.0%

      \[ {x}^{-0.5} - \frac{\color{blue}{{\left(x + 1\right)}^{-0.16666666666666666}}}{\sqrt[3]{x + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.8%

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

Alternatives

Alternative 1
Accuracy83.7%
Cost66372
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-8}:\\ \;\;\;\;0.3125 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.2734375 \cdot \sqrt{\frac{1}{{x}^{9}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \frac{{\left(1 + x\right)}^{-0.16666666666666666}}{\sqrt[3]{1 + x}}\\ \end{array} \]
Alternative 2
Accuracy83.7%
Cost53124
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-8}:\\ \;\;\;\;0.3125 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \frac{{\left(1 + x\right)}^{-0.16666666666666666}}{\sqrt[3]{1 + x}}\\ \end{array} \]
Alternative 3
Accuracy83.3%
Cost39876
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-16}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} + -0.375 \cdot \sqrt{\frac{1}{{x}^{5}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-\sqrt[3]{\frac{1}{1 + x}}, {\left(1 + x\right)}^{-0.16666666666666666}, {x}^{-0.5}\right)\\ \end{array} \]
Alternative 4
Accuracy83.2%
Cost39812
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-16}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-\sqrt[3]{\frac{1}{1 + x}}, {\left(1 + x\right)}^{-0.16666666666666666}, {x}^{-0.5}\right)\\ \end{array} \]
Alternative 5
Accuracy83.3%
Cost26756
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-16}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{1 + x}}\\ \end{array} \]
Alternative 6
Accuracy83.3%
Cost13380
\[\begin{array}{l} \mathbf{if}\;x \leq 126000000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]
Alternative 7
Accuracy82.3%
Cost13316
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{x}^{-0.5} - \left(1 + x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]
Alternative 8
Accuracy51.7%
Cost13056
\[\left|{x}^{-0.5} + -1\right| \]
Alternative 9
Accuracy51.4%
Cost6912
\[{x}^{-0.5} - \left(1 + x \cdot -0.5\right) \]
Alternative 10
Accuracy50.6%
Cost6656
\[{x}^{-0.5} + -1 \]
Alternative 11
Accuracy50.8%
Cost6528
\[{x}^{-0.5} \]
Alternative 12
Accuracy1.9%
Cost64
\[-1 \]

Reproduce?

herbie shell --seed 2023277 
(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)))))