2isqrt (example 3.6)

?

Percentage Accurate: 68.8% → 99.8%
Time: 14.7s
Precision: binary64
Cost: 26372

?

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{x}\\


\end{array}

Local Percentage Accuracy?

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 14 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Target

Original68.8%
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 x < 3.5000000000000001e130

    1. Initial program 71.4%

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

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

      [Start]71.4

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

      frac-sub [=>]71.4

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

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

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

      +-commutative [=>]71.4

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

      *-rgt-identity [=>]71.4

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

      sqrt-unprod [=>]71.4

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

      +-commutative [=>]71.4

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

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

      [Start]71.4

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

      flip-- [=>]71.6

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

      div-inv [=>]71.6

      \[ \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 \cdot \left(1 + x\right)}} \]

      add-sqr-sqrt [<=]72.2

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

      add-sqr-sqrt [<=]73.5

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

      associate--l+ [=>]99.5

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      Step-by-step derivation

      [Start]99.5

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

      +-inverses [=>]99.5

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

      metadata-eval [=>]99.5

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

      *-lft-identity [=>]99.5

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

      rem-square-sqrt [<=]99.5

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

      hypot-1-def [=>]99.5

      \[ \frac{\frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{x}\right)} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. 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}}} \]
      Step-by-step derivation

      [Start]99.5

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

      add-log-exp [=>]8.7

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

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

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

      log-prod [=>]8.7

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

      metadata-eval [=>]8.7

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

      add-log-exp [<=]99.5

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

      associate-/l/ [=>]99.7

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

      associate-/r* [=>]99.7

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

      pow1/2 [=>]99.7

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

      pow-flip [=>]99.8

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

      +-commutative [=>]99.8

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

      distribute-lft-in [=>]99.8

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

      *-rgt-identity [=>]99.8

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

      fma-def [=>]99.8

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

      metadata-eval [=>]99.8

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

      +-commutative [=>]99.8

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

      hypot-1-def [<=]99.8

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

      add-sqr-sqrt [<=]99.9

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

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

      [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}}} \]

    if 3.5000000000000001e130 < x

    1. Initial program 54.9%

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

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

      [Start]54.9

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

      frac-sub [=>]54.9

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

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

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

      +-commutative [=>]54.9

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

      *-rgt-identity [=>]54.9

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

      sqrt-unprod [=>]54.9

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

      +-commutative [=>]54.9

      \[ \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
    3. Applied egg-rr65.2%

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

      [Start]54.9

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

      flip-- [=>]54.9

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

      div-inv [=>]54.9

      \[ \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 \cdot \left(1 + x\right)}} \]

      add-sqr-sqrt [<=]54.9

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

      add-sqr-sqrt [<=]54.9

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

      associate--l+ [=>]65.2

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

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

      [Start]65.2

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

      +-inverses [=>]65.2

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

      metadata-eval [=>]65.2

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

      *-lft-identity [=>]65.2

      \[ \frac{\color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. Taylor expanded in x around inf 99.8%

      \[\leadsto \frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\color{blue}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.5 \cdot 10^{+130}:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(x, x, x\right)\right)}^{-0.5}}{\sqrt{x} + \sqrt{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{x}\\ \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.7%
Cost27268
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \leq 5 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \frac{0.375}{x \cdot x}\right)}{\sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{x + 1}}\\ \end{array} \]
Alternative 3
Accuracy99.8%
Cost27204
\[\begin{array}{l} t_0 := \sqrt{x + 1}\\ \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{t_0} \leq 5 \cdot 10^{-7}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + t_0}}{\left(x + 0.5\right) + \frac{-0.125}{x}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{x + 1}}\\ \end{array} \]
Alternative 4
Accuracy99.6%
Cost26692
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \leq 5 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{0.5 - \frac{0.375}{x}}{x}}{\sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \end{array} \]
Alternative 5
Accuracy99.0%
Cost26304
\[\frac{-1}{\left(\sqrt{x} + \sqrt{x + 1}\right) \cdot \left(-\mathsf{hypot}\left(x, \sqrt{x}\right)\right)} \]
Alternative 6
Accuracy99.8%
Cost14276
\[\begin{array}{l} \mathbf{if}\;x \leq 860:\\ \;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{x + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x} + \sqrt{x + 1}}}{\left(x + \left(0.5 + \frac{0.0625}{x \cdot x}\right)\right) - \frac{0.125}{x}}\\ \end{array} \]
Alternative 7
Accuracy98.4%
Cost7108
\[\begin{array}{l} \mathbf{if}\;x \leq 1.1:\\ \;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 - \frac{0.375}{x}}{x \cdot \sqrt{x}}\\ \end{array} \]
Alternative 8
Accuracy99.0%
Cost7108
\[\begin{array}{l} \mathbf{if}\;x \leq 1.1:\\ \;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5 - \frac{0.375}{x}}{x}}{\sqrt{x}}\\ \end{array} \]
Alternative 9
Accuracy98.5%
Cost7044
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;{x}^{-0.5} + \left(-1 - x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x}}\\ \end{array} \]
Alternative 10
Accuracy98.2%
Cost6852
\[\begin{array}{l} \mathbf{if}\;x \leq 0.65:\\ \;\;\;\;-1 + {x}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x}}\\ \end{array} \]
Alternative 11
Accuracy67.0%
Cost6788
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;-1 + {x}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 12
Accuracy66.1%
Cost6724
\[\begin{array}{l} \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{1}{\sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 13
Accuracy19.3%
Cost64
\[0 \]

Reproduce?

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