Average Error: 20.1 → 20.0
Time: 12.8s
Precision: binary64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[{x}^{-0.5} - {\left(x + 1\right)}^{-0.5} \]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (- (pow x -0.5) (pow (+ x 1.0) -0.5)))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
	return pow(x, -0.5) - pow((x + 1.0), -0.5);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.1
Target0.7
Herbie20.0
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation

  1. Initial program 20.1

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Applied pow1/2_binary6420.1

    \[\leadsto \frac{1}{\color{blue}{{x}^{0.5}}} - \frac{1}{\sqrt{x + 1}} \]
  3. Applied pow-flip_binary6422.6

    \[\leadsto \color{blue}{{x}^{\left(-0.5\right)}} - \frac{1}{\sqrt{x + 1}} \]
  4. Simplified22.6

    \[\leadsto {x}^{\color{blue}{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  5. Applied pow1/2_binary6422.6

    \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}} \]
  6. Applied pow-flip_binary6420.0

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

    \[\leadsto {x}^{-0.5} - {\left(x + 1\right)}^{\color{blue}{-0.5}} \]
  8. Final simplification20.0

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

Reproduce

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