\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\begin{array}{l}
\mathbf{if}\;x \leq 2.3678566194252168 \cdot 10^{+91}:\\
\;\;\;\;{x}^{-0.5} - \frac{1}{\sqrt{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (if (<= x 2.3678566194252168e+91) (- (pow x -0.5) (/ 1.0 (sqrt (+ x 1.0)))) 0.0))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
double tmp;
if (x <= 2.3678566194252168e+91) {
tmp = pow(x, -0.5) - (1.0 / sqrt(x + 1.0));
} else {
tmp = 0.0;
}
return tmp;
}












Bits error versus x
Results
| Original | 20.4 |
|---|---|
| Target | 0.7 |
| Herbie | 20.3 |
| Alternative 1 | |
|---|---|
| Error | 20.4 |
| Cost | 13376 |
| Alternative 2 | |
|---|---|
| Error | 20.4 |
| Cost | 13633 |
| Alternative 3 | |
|---|---|
| Error | 21.0 |
| Cost | 7681 |
| Alternative 4 | |
|---|---|
| Error | 21.1 |
| Cost | 7425 |
| Alternative 5 | |
|---|---|
| Error | 21.3 |
| Cost | 7297 |
| Alternative 6 | |
|---|---|
| Error | 21.6 |
| Cost | 6977 |
| Alternative 7 | |
|---|---|
| Error | 50.2 |
| Cost | 385 |
| Alternative 8 | |
|---|---|
| Error | 60.3 |
| Cost | 64 |


if x < 2.36785661942521678e91Initial program 13.5
rmApplied pow1/2_binary64_220413.5
Applied pow-flip_binary64_219813.2
Simplified13.2
Simplified13.2
if 2.36785661942521678e91 < x Initial program 33.2
Simplified33.2
Final simplification20.3
herbie shell --seed 2021040
(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)))))