\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\frac{\frac{\frac{1}{t_0 + \sqrt{x}}}{\sqrt{x}}}{t_0}
\end{array}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ 1.0 x)))) (/ (/ (/ 1.0 (+ t_0 (sqrt x))) (sqrt x)) t_0)))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
double t_0 = sqrt(1.0 + x);
return ((1.0 / (t_0 + sqrt(x))) / sqrt(x)) / t_0;
}




Bits error versus x
Results
| Original | 19.7 |
|---|---|
| Target | 0.6 |
| Herbie | 0.4 |
Initial program 19.7
rmApplied frac-sub_binary6419.7
Simplified19.7
Simplified19.7
rmApplied flip--_binary6419.5
Simplified0.4
rmApplied associate-/r*_binary640.4
Final simplification0.4
herbie shell --seed 2021211
(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)))))