Average Error: 19.5 → 0.4
Time: 4.2s
Precision: binary64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{\frac{1}{x + \left(\sqrt{x} \cdot \left|\sqrt[3]{1 + x}\right|\right) \cdot \sqrt{\sqrt[3]{1 + x}}}}{\sqrt{1 + x}}\]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{\frac{1}{x + \left(\sqrt{x} \cdot \left|\sqrt[3]{1 + x}\right|\right) \cdot \sqrt{\sqrt[3]{1 + x}}}}{\sqrt{1 + x}}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (/
  (/
   1.0
   (+ x (* (* (sqrt x) (fabs (cbrt (+ 1.0 x)))) (sqrt (cbrt (+ 1.0 x))))))
  (sqrt (+ 1.0 x))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
	return (1.0 / (x + ((sqrt(x) * fabs(cbrt(1.0 + x))) * sqrt(cbrt(1.0 + x))))) / sqrt(1.0 + x);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 19.5

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  2. Using strategy rm
  3. Applied frac-sub_binary64_177119.5

    \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}\]
  4. Simplified19.5

    \[\leadsto \frac{\color{blue}{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  5. Simplified19.5

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{\sqrt{x} \cdot \sqrt{1 + x}}}\]
  6. Using strategy rm
  7. Applied flip--_binary64_173719.3

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{1 + x}}\]
  8. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{1 + x}}\]
  9. Using strategy rm
  10. Applied associate-/r*_binary64_17080.4

    \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}}}\]
  11. Simplified0.3

    \[\leadsto \frac{\color{blue}{\frac{1}{x + \sqrt{x} \cdot \sqrt{x + 1}}}}{\sqrt{1 + x}}\]
  12. Using strategy rm
  13. Applied add-cube-cbrt_binary64_17940.4

    \[\leadsto \frac{\frac{1}{x + \sqrt{x} \cdot \sqrt{\color{blue}{\left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right) \cdot \sqrt[3]{x + 1}}}}}{\sqrt{1 + x}}\]
  14. Applied sqrt-prod_binary64_17770.4

    \[\leadsto \frac{\frac{1}{x + \sqrt{x} \cdot \color{blue}{\left(\sqrt{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \cdot \sqrt{\sqrt[3]{x + 1}}\right)}}}{\sqrt{1 + x}}\]
  15. Applied associate-*r*_binary64_17040.4

    \[\leadsto \frac{\frac{1}{x + \color{blue}{\left(\sqrt{x} \cdot \sqrt{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}\right) \cdot \sqrt{\sqrt[3]{x + 1}}}}}{\sqrt{1 + x}}\]
  16. Simplified0.4

    \[\leadsto \frac{\frac{1}{x + \color{blue}{\left(\sqrt{x} \cdot \left|\sqrt[3]{1 + x}\right|\right)} \cdot \sqrt{\sqrt[3]{x + 1}}}}{\sqrt{1 + x}}\]
  17. Final simplification0.4

    \[\leadsto \frac{\frac{1}{x + \left(\sqrt{x} \cdot \left|\sqrt[3]{1 + x}\right|\right) \cdot \sqrt{\sqrt[3]{1 + x}}}}{\sqrt{1 + x}}\]

Reproduce

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