\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\begin{array}{l}
\mathbf{if}\;x \leq 5.641413807697915 \cdot 10^{+96}:\\
\;\;\;\;{x}^{-0.5} - \frac{\frac{1}{\left|\sqrt[3]{x + 1}\right|}}{\sqrt{\sqrt[3]{x + 1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{{x}^{1.5}} + \frac{-1}{{\left(\sqrt{x + 1}\right)}^{3}}}{\frac{1}{x} + \left(\frac{1}{x + 1} + \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}\right)}\\
\end{array}(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
:precision binary64
(if (<= x 5.641413807697915e+96)
(- (pow x -0.5) (/ (/ 1.0 (fabs (cbrt (+ x 1.0)))) (sqrt (cbrt (+ x 1.0)))))
(/
(+ (/ 1.0 (pow x 1.5)) (/ -1.0 (pow (sqrt (+ x 1.0)) 3.0)))
(+
(/ 1.0 x)
(+ (/ 1.0 (+ x 1.0)) (/ (/ 1.0 (sqrt x)) (sqrt (+ x 1.0))))))))double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
double tmp;
if (x <= 5.641413807697915e+96) {
tmp = pow(x, -0.5) - ((1.0 / fabs(cbrt(x + 1.0))) / sqrt(cbrt(x + 1.0)));
} else {
tmp = ((1.0 / pow(x, 1.5)) + (-1.0 / pow(sqrt(x + 1.0), 3.0))) / ((1.0 / x) + ((1.0 / (x + 1.0)) + ((1.0 / sqrt(x)) / sqrt(x + 1.0))));
}
return tmp;
}




Bits error versus x
Results
| Original | 19.9 |
|---|---|
| Target | 0.6 |
| Herbie | 19.9 |
if x < 5.64141380769791462e96Initial program 14.2
rmApplied pow1/2_binary6414.2
Applied pow-flip_binary6414.0
Simplified14.0
rmApplied add-cube-cbrt_binary6413.9
Applied sqrt-prod_binary6413.9
Applied associate-/r*_binary6413.9
Simplified13.9
if 5.64141380769791462e96 < x Initial program 31.3
rmApplied add-sqr-sqrt_binary6443.9
Applied associate-/r*_binary6446.3
rmApplied flip3--_binary6431.7
Simplified31.8
Simplified31.8
Final simplification19.9
herbie shell --seed 2020253
(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)))))