Average Error: 19.7 → 19.7
Time: 30.3s
Precision: binary64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\frac{1}{\sqrt{x}} - \frac{1}{\mathsf{hypot}\left(\sqrt{x}, 1\right)} \]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{1}{\sqrt{x}} - \frac{1}{\mathsf{hypot}\left(\sqrt{x}, 1\right)}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (- (/ 1.0 (sqrt x)) (/ 1.0 (hypot (sqrt x) 1.0))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / hypot(sqrt(x), 1.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.7
Target0.7
Herbie19.7
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation

  1. Initial program 19.7

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Applied *-un-lft-identity_binary6419.7

    \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + \color{blue}{1 \cdot 1}}} \]
  3. Applied add-sqr-sqrt_binary6419.7

    \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + 1 \cdot 1}} \]
  4. Applied hypot-def_binary6419.7

    \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{\mathsf{hypot}\left(\sqrt{x}, 1\right)}} \]
  5. Final simplification19.7

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

Reproduce

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