?

Average Accuracy: 69.2% → 100.0%
Time: 13.7s
Precision: binary64
Cost: 27012

?

\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 0:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{1 + \left(x + \sqrt{x \cdot \left(x + 1\right)}\right)}\\ \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 (+ x 1.0)))) 0.0)
   (* 0.5 (pow x -1.5))
   (/ (pow x -0.5) (+ 1.0 (+ x (sqrt (* x (+ x 1.0))))))))
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((x + 1.0)))) <= 0.0) {
		tmp = 0.5 * pow(x, -1.5);
	} else {
		tmp = pow(x, -0.5) / (1.0 + (x + sqrt((x * (x + 1.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) :: tmp
    if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((x + 1.0d0)))) <= 0.0d0) then
        tmp = 0.5d0 * (x ** (-1.5d0))
    else
        tmp = (x ** (-0.5d0)) / (1.0d0 + (x + sqrt((x * (x + 1.0d0)))))
    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 tmp;
	if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((x + 1.0)))) <= 0.0) {
		tmp = 0.5 * Math.pow(x, -1.5);
	} else {
		tmp = Math.pow(x, -0.5) / (1.0 + (x + Math.sqrt((x * (x + 1.0)))));
	}
	return tmp;
}
def code(x):
	return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
def code(x):
	tmp = 0
	if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((x + 1.0)))) <= 0.0:
		tmp = 0.5 * math.pow(x, -1.5)
	else:
		tmp = math.pow(x, -0.5) / (1.0 + (x + math.sqrt((x * (x + 1.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)
	tmp = 0.0
	if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(x + 1.0)))) <= 0.0)
		tmp = Float64(0.5 * (x ^ -1.5));
	else
		tmp = Float64((x ^ -0.5) / Float64(1.0 + Float64(x + sqrt(Float64(x * Float64(x + 1.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)
	tmp = 0.0;
	if (((1.0 / sqrt(x)) + (-1.0 / sqrt((x + 1.0)))) <= 0.0)
		tmp = 0.5 * (x ^ -1.5);
	else
		tmp = (x ^ -0.5) / (1.0 + (x + sqrt((x * (x + 1.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_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.0 + N[(x + N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 0:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original69.2%
Target99.0%
Herbie100.0%
\[\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 37.3%

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

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

      [Start]37.3

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

      flip-- [=>]37.3

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

      div-inv [=>]37.3

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

      *-commutative [=>]37.3

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

      pow1/2 [=>]37.3

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

      pow-flip [=>]37.3

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

      metadata-eval [=>]37.3

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

      pow1/2 [=>]37.3

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

      pow-flip [=>]37.3

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

      +-commutative [=>]37.3

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

      metadata-eval [=>]37.3

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

      cancel-sign-sub-inv [=>]37.3

      \[ \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \cdot \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
    3. Taylor expanded in x around inf 65.3%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    4. Applied egg-rr37.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({x}^{-1.5}\right)} - 1\right)} \]
      Proof

      [Start]65.3

      \[ 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}} \]

      expm1-log1p-u [=>]65.3

      \[ 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1}{{x}^{3}}}\right)\right)} \]

      expm1-udef [=>]37.3

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

      pow-flip [=>]37.3

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

      sqrt-pow1 [=>]37.3

      \[ 0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{x}^{\left(\frac{-3}{2}\right)}}\right)} - 1\right) \]

      metadata-eval [=>]37.3

      \[ 0.5 \cdot \left(e^{\mathsf{log1p}\left({x}^{\left(\frac{\color{blue}{-3}}{2}\right)}\right)} - 1\right) \]

      metadata-eval [=>]37.3

      \[ 0.5 \cdot \left(e^{\mathsf{log1p}\left({x}^{\color{blue}{-1.5}}\right)} - 1\right) \]
    5. Simplified100.0%

      \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
      Proof

      [Start]37.3

      \[ 0.5 \cdot \left(e^{\mathsf{log1p}\left({x}^{-1.5}\right)} - 1\right) \]

      expm1-def [=>]100.0

      \[ 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-1.5}\right)\right)} \]

      expm1-log1p [=>]100.0

      \[ 0.5 \cdot \color{blue}{{x}^{-1.5}} \]

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

    1. Initial program 97.7%

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

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

      [Start]97.7

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

      add-cbrt-cube [=>]97.6

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

      pow1/3 [=>]97.4

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

      add-sqr-sqrt [<=]97.4

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

      pow1 [=>]97.4

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

      pow1/2 [=>]97.4

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

      pow-prod-up [=>]97.4

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

      +-commutative [=>]97.4

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

      metadata-eval [=>]97.4

      \[ \frac{1}{\sqrt{x}} - \frac{1}{{\left({\left(1 + x\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333}} \]
    3. Simplified97.7%

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

      [Start]97.4

      \[ \frac{1}{\sqrt{x}} - \frac{1}{{\left({\left(1 + x\right)}^{1.5}\right)}^{0.3333333333333333}} \]

      unpow1/3 [=>]97.7

      \[ \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\sqrt[3]{{\left(1 + x\right)}^{1.5}}}} \]
    4. Applied egg-rr99.9%

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

      [Start]97.7

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

      frac-sub [=>]97.7

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

      div-inv [=>]97.7

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

      *-rgt-identity [=>]97.7

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

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

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

      flip-- [=>]98.0

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

      metadata-eval [<=]98.0

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

      frac-times [<=]98.0

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

      associate-*l/ [=>]98.0

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

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

      [Start]99.9

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

      +-commutative [=>]99.9

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

      +-inverses [=>]99.9

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

      metadata-eval [=>]99.9

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

      associate-*r/ [=>]99.9

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

      associate-/l/ [=>]99.9

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

      *-lft-identity [=>]99.9

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

      +-commutative [=>]99.9

      \[ \frac{{x}^{-0.5}}{\color{blue}{\left(\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)\right)} \cdot \mathsf{hypot}\left(1, \sqrt{x}\right)} \]
    6. Applied egg-rr99.9%

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

      [Start]99.9

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

      *-commutative [=>]99.9

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

      distribute-rgt-in [=>]99.9

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

      hypot-udef [=>]99.9

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

      hypot-udef [=>]99.9

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

      add-sqr-sqrt [<=]99.9

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

      metadata-eval [=>]99.9

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

      add-sqr-sqrt [<=]99.9

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

      +-commutative [=>]99.9

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

      associate-+r+ [=>]99.9

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

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

Alternatives

Alternative 1
Accuracy99.6%
Cost39040
\[\begin{array}{l} t_0 := \mathsf{hypot}\left(1, \sqrt{x}\right)\\ \frac{{x}^{-0.5}}{t_0 \cdot \left(\sqrt{x} + t_0\right)} \end{array} \]
Alternative 2
Accuracy99.2%
Cost26692
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{x + 1}} \leq 2 \cdot 10^{-21}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \end{array} \]
Alternative 3
Accuracy99.4%
Cost13696
\[\frac{\frac{1}{x}}{{x}^{-0.5} \cdot \left(x + 1\right) + \sqrt{x + 1}} \]
Alternative 4
Accuracy98.6%
Cost7172
\[\begin{array}{l} \mathbf{if}\;x \leq 1.7:\\ \;\;\;\;{x}^{-0.5} - \frac{1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \]
Alternative 5
Accuracy98.6%
Cost7044
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{x}^{-0.5} + \left(-1 + x \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \]
Alternative 6
Accuracy96.8%
Cost6788
\[\begin{array}{l} \mathbf{if}\;x \leq 0.5:\\ \;\;\;\;{x}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \]
Alternative 7
Accuracy98.3%
Cost6788
\[\begin{array}{l} \mathbf{if}\;x \leq 0.66:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \]
Alternative 8
Accuracy50.9%
Cost6528
\[{x}^{-0.5} \]
Alternative 9
Accuracy3.9%
Cost192
\[x \cdot 0.5 \]
Alternative 10
Accuracy1.9%
Cost64
\[-1 \]

Error

Reproduce?

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