?

Average Accuracy: 69.2% → 99.8%
Time: 12.4s
Precision: binary64
Cost: 39684

?

\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\begin{array}{l} t_0 := \sqrt{x + 1}\\ t_1 := \sqrt{x} + t_0\\ \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 0:\\ \;\;\;\;\frac{\frac{1}{t_1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(x, x, x\right)\right)}^{-0.5}}{t_1}\\ \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ x 1.0))) (t_1 (+ (sqrt x) t_0)))
   (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 t_0)) 0.0)
     (/ (/ 1.0 t_1) x)
     (/ (pow (fma x x x) -0.5) t_1))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
double code(double x) {
	double t_0 = sqrt((x + 1.0));
	double t_1 = sqrt(x) + t_0;
	double tmp;
	if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 0.0) {
		tmp = (1.0 / t_1) / x;
	} else {
		tmp = pow(fma(x, x, x), -0.5) / t_1;
	}
	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(x + 1.0))
	t_1 = Float64(sqrt(x) + t_0)
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / t_0)) <= 0.0)
		tmp = Float64(Float64(1.0 / t_1) / x);
	else
		tmp = Float64((fma(x, x, x) ^ -0.5) / t_1);
	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_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(1.0 / t$95$1), $MachinePrecision] / x), $MachinePrecision], N[(N[Power[N[(x * x + x), $MachinePrecision], -0.5], $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
t_1 := \sqrt{x} + t_0\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 0:\\
\;\;\;\;\frac{\frac{1}{t_1}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(x, x, x\right)\right)}^{-0.5}}{t_1}\\


\end{array}

Error?

Target

Original69.2%
Target99.0%
Herbie99.8%
\[\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)))) < 0.0

    1. Initial program 36.4%

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

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

      [Start]36.4

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

      frac-sub [=>]36.4

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

      clear-num [=>]36.4

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

      sqrt-unprod [=>]36.4

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

      +-commutative [=>]36.4

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

      *-un-lft-identity [<=]36.4

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

      *-rgt-identity [=>]36.4

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

      +-commutative [=>]36.4

      \[ \frac{1}{\frac{\sqrt{x \cdot \left(1 + x\right)}}{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}} \]
    3. Simplified36.4%

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

      [Start]36.4

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

      associate-/r/ [=>]36.4

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

      associate-*l/ [=>]36.4

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

      *-lft-identity [=>]36.4

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

      distribute-rgt-in [=>]36.4

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

      *-lft-identity [=>]36.4

      \[ \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{\color{blue}{x} + x \cdot x}} \]
    4. Applied egg-rr36.5%

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

      [Start]36.4

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

      flip-- [=>]36.4

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

      div-inv [=>]36.4

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

      add-sqr-sqrt [<=]36.5

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

      +-commutative [=>]36.5

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

      add-sqr-sqrt [<=]36.5

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

      associate--l+ [=>]36.5

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

      +-commutative [=>]36.5

      \[ \frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    5. Simplified82.4%

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

      [Start]36.5

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

      associate-*r/ [=>]36.5

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

      *-rgt-identity [=>]36.5

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

      +-commutative [=>]36.5

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

      associate-+l- [=>]82.4

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

      +-inverses [=>]82.4

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

      metadata-eval [=>]82.4

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

      +-commutative [=>]82.4

      \[ \frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x + x \cdot x}} \]
    6. Taylor expanded in x around inf 99.6%

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

    if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 97.5%

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

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

      [Start]97.5

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

      frac-sub [=>]97.5

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

      clear-num [=>]97.5

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

      sqrt-unprod [=>]97.5

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

      +-commutative [=>]97.5

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

      *-un-lft-identity [<=]97.5

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

      *-rgt-identity [=>]97.5

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

      +-commutative [=>]97.5

      \[ \frac{1}{\frac{\sqrt{x \cdot \left(1 + x\right)}}{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}} \]
    3. Simplified97.5%

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

      [Start]97.5

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

      associate-/r/ [=>]97.5

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

      associate-*l/ [=>]97.5

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

      *-lft-identity [=>]97.5

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

      distribute-rgt-in [=>]97.5

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

      *-lft-identity [=>]97.5

      \[ \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{\color{blue}{x} + x \cdot x}} \]
    4. Applied egg-rr99.5%

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

      [Start]97.5

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

      flip-- [=>]98.2

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

      div-inv [=>]98.2

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

      add-sqr-sqrt [<=]98.6

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

      +-commutative [=>]98.6

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

      add-sqr-sqrt [<=]99.5

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

      associate--l+ [=>]99.5

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

      +-commutative [=>]99.5

      \[ \frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    5. Simplified99.5%

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

      [Start]99.5

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

      associate-*r/ [=>]99.5

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

      *-rgt-identity [=>]99.5

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

      +-commutative [=>]99.5

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

      associate-+l- [=>]99.5

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

      +-inverses [=>]99.5

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

      metadata-eval [=>]99.5

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

      +-commutative [=>]99.5

      \[ \frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x + x \cdot x}} \]
    6. Applied egg-rr99.9%

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

      [Start]99.5

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

      add-log-exp [=>]3.8

      \[ \color{blue}{\log \left(e^{\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x + x \cdot x}}}\right)} \]

      *-un-lft-identity [=>]3.8

      \[ \log \color{blue}{\left(1 \cdot e^{\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x + x \cdot x}}}\right)} \]

      log-prod [=>]3.8

      \[ \color{blue}{\log 1 + \log \left(e^{\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x + x \cdot x}}}\right)} \]

      metadata-eval [=>]3.8

      \[ \color{blue}{0} + \log \left(e^{\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x + x \cdot x}}}\right) \]

      add-log-exp [<=]99.5

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

      associate-/l/ [=>]99.5

      \[ 0 + \color{blue}{\frac{1}{\sqrt{x + x \cdot x} \cdot \left(\sqrt{x} + \sqrt{x + 1}\right)}} \]

      associate-/r* [=>]99.5

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

      pow1/2 [=>]99.5

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

      pow-flip [=>]99.9

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

      +-commutative [=>]99.9

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

      fma-def [=>]99.9

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

      metadata-eval [=>]99.9

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

      +-commutative [=>]99.9

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

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

      [Start]99.9

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

      +-lft-identity [=>]99.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 0:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(x, x, x\right)\right)}^{-0.5}}{\sqrt{x} + \sqrt{x + 1}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.5%
Cost52224
\[\begin{array}{l} t_0 := {\left(\sqrt{x} + \sqrt{x + 1}\right)}^{-0.5}\\ t_0 \cdot \frac{t_0}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \end{array} \]
Alternative 2
Accuracy99.2%
Cost33088
\[\begin{array}{l} t_0 := \sqrt{x + 1}\\ \frac{\frac{1}{\sqrt{x} + t_0}}{{x}^{0.25} \cdot \left(t_0 \cdot {x}^{0.25}\right)} \end{array} \]
Alternative 3
Accuracy98.9%
Cost32576
\[{\left(\left(\sqrt{x} + \sqrt{x + 1}\right) \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)\right)}^{-1} \]
Alternative 4
Accuracy99.6%
Cost26948
\[\begin{array}{l} t_0 := \sqrt{x + 1}\\ \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 10^{-11}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + t_0}}{x + 0.5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \end{array} \]
Alternative 5
Accuracy99.3%
Cost26820
\[\begin{array}{l} t_0 := \sqrt{x + 1}\\ \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 5 \cdot 10^{-13}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + t_0}}{x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \end{array} \]
Alternative 6
Accuracy83.4%
Cost13380
\[\begin{array}{l} \mathbf{if}\;x \leq 52000000:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]
Alternative 7
Accuracy82.5%
Cost13316
\[\begin{array}{l} \mathbf{if}\;x \leq 1.7:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]
Alternative 8
Accuracy68.5%
Cost7492
\[\begin{array}{l} \mathbf{if}\;x \leq 1.22:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x} + \frac{-1}{x + 1}}{2 \cdot \sqrt{\frac{1}{x}}}\\ \end{array} \]
Alternative 9
Accuracy68.5%
Cost7172
\[\begin{array}{l} \mathbf{if}\;x \leq 5.9:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + x \cdot x}}\\ \end{array} \]
Alternative 10
Accuracy68.4%
Cost7044
\[\begin{array}{l} \mathbf{if}\;x \leq 1.4:\\ \;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + x \cdot x}}\\ \end{array} \]
Alternative 11
Accuracy68.1%
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 0.7:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + x \cdot x}}\\ \end{array} \]
Alternative 12
Accuracy67.1%
Cost6788
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 13
Accuracy66.2%
Cost6724
\[\begin{array}{l} \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{1}{\sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 14
Accuracy21.6%
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x + 0.5}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 15
Accuracy21.6%
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 16
Accuracy18.3%
Cost64
\[0 \]

Error

Reproduce?

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