Average Error: 19.3 → 0.3
Time: 1.1min
Precision: binary64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
\[\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{x}} \cdot \frac{\frac{\frac{1}{\sqrt{x}}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}} \]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{x}} \cdot \frac{\frac{\frac{1}{\sqrt{x}}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (*
  (/ (* (cbrt 1.0) (cbrt 1.0)) (sqrt x))
  (/
   (/ (/ 1.0 (sqrt x)) (+ 1.0 x))
   (+ (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ 1.0 x)))))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
	return ((cbrt(1.0) * cbrt(1.0)) / sqrt(x)) * (((1.0 / sqrt(x)) / (1.0 + x)) / ((1.0 / sqrt(x)) + (1.0 / 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.3
Target0.7
Herbie0.3
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \]

Derivation

  1. Initial program 19.3

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

    \[\leadsto \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}}}} \]
  4. Simplified19.4

    \[\leadsto \frac{\color{blue}{\frac{1}{x} - \frac{1}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
  5. Using strategy rm
  6. Applied frac-sub_binary64_281518.8

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
  7. Simplified5.9

    \[\leadsto \frac{\frac{\color{blue}{1 + 0}}{x \cdot \left(1 + x\right)}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
  8. Using strategy rm
  9. Applied *-un-lft-identity_binary64_28065.9

    \[\leadsto \frac{\frac{1 + 0}{x \cdot \left(1 + x\right)}}{\color{blue}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)}} \]
  10. Applied add-cube-cbrt_binary64_28415.9

    \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1 + 0} \cdot \sqrt[3]{1 + 0}\right) \cdot \sqrt[3]{1 + 0}}}{x \cdot \left(1 + x\right)}}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)} \]
  11. Applied times-frac_binary64_28125.5

    \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1 + 0} \cdot \sqrt[3]{1 + 0}}{x} \cdot \frac{\sqrt[3]{1 + 0}}{1 + x}}}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)} \]
  12. Applied times-frac_binary64_28120.4

    \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{1 + 0} \cdot \sqrt[3]{1 + 0}}{x}}{1} \cdot \frac{\frac{\sqrt[3]{1 + 0}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
  13. Simplified0.4

    \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{\frac{\sqrt[3]{1 + 0}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
  14. Simplified0.4

    \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{\left(1 + x\right) \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}\right)}} \]
  15. Using strategy rm
  16. Applied add-sqr-sqrt_binary64_28280.4

    \[\leadsto \frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} \cdot \frac{1}{\left(1 + x\right) \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}\right)} \]
  17. Applied add-cube-cbrt_binary64_28410.4

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

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

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

    \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{x}} \cdot \color{blue}{\frac{\frac{\frac{1}{\sqrt{x}}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}} \]
  21. Final simplification0.3

    \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt{x}} \cdot \frac{\frac{\frac{1}{\sqrt{x}}}{1 + x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}} \]

Reproduce

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