Average Error: 19.5 → 0.3
Time: 18.5s
Precision: binary64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{\frac{\frac{1}{1 + x}}{\sqrt{x}}}{\frac{\sqrt{x}}{\sqrt{x}} + \frac{\sqrt{x}}{\sqrt{1 + x}}}\]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{\frac{\frac{1}{1 + x}}{\sqrt{x}}}{\frac{\sqrt{x}}{\sqrt{x}} + \frac{\sqrt{x}}{\sqrt{1 + x}}}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
 :precision binary64
 (/
  (/ (/ 1.0 (+ 1.0 x)) (sqrt x))
  (+ (/ (sqrt x) (sqrt x)) (/ (sqrt 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 / (1.0 + x)) / sqrt(x)) / ((sqrt(x) / sqrt(x)) + (sqrt(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.3
\[\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 flip--_binary64_141719.6

    \[\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.6

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

    \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}}\]
  6. Using strategy rm
  7. Applied frac-sub_binary64_145118.9

    \[\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{1 + x}}}\]
  8. Simplified5.5

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

    \[\leadsto \frac{\frac{1}{\color{blue}{x + x \cdot x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}\]
  10. Using strategy rm
  11. Applied distribute-rgt1-in_binary64_13985.5

    \[\leadsto \frac{\frac{1}{\color{blue}{\left(x + 1\right) \cdot x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}\]
  12. Applied *-un-lft-identity_binary64_14425.5

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{\left(x + 1\right) \cdot x}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}\]
  13. Applied times-frac_binary64_14485.1

    \[\leadsto \frac{\color{blue}{\frac{1}{x + 1} \cdot \frac{1}{x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{1 + x}}}\]
  14. Applied associate-/l*_binary64_13870.5

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

    \[\leadsto \frac{\frac{1}{x + 1}}{\color{blue}{\frac{x}{\sqrt{x}} + \frac{x}{\sqrt{1 + x}}}}\]
  16. Using strategy rm
  17. Applied *-un-lft-identity_binary64_14420.4

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

    \[\leadsto \frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x}} + \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{1 \cdot \sqrt{1 + x}}}\]
  19. Applied times-frac_binary64_14480.3

    \[\leadsto \frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x}} + \color{blue}{\frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}}}\]
  20. Applied *-un-lft-identity_binary64_14420.3

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

    \[\leadsto \frac{\frac{1}{x + 1}}{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{1 \cdot \sqrt{x}} + \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}}\]
  22. Applied times-frac_binary64_14480.3

    \[\leadsto \frac{\frac{1}{x + 1}}{\color{blue}{\frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{\sqrt{x}}} + \frac{\sqrt{x}}{1} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}}\]
  23. Applied distribute-lft-out_binary64_13930.3

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

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

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

Reproduce

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