\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\begin{array}{l}
\mathbf{if}\;x \le 7117.86092887425093:\\
\;\;\;\;\frac{1}{\sqrt{x}} - \left(\sqrt[3]{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot \left(\left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{4}}\right) - \frac{1}{{x}^{3}}\right)}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\\
\end{array}double code(double x) {
return ((1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0))));
}
double code(double x) {
double VAR;
if ((x <= 7117.860928874251)) {
VAR = ((1.0 / sqrt(x)) - ((cbrt((1.0 / sqrt((x + 1.0)))) * cbrt((1.0 / sqrt((x + 1.0))))) * cbrt((1.0 / sqrt((x + 1.0))))));
} else {
VAR = ((1.0 * (((1.0 / pow(x, 2.0)) + (1.0 / pow(x, 4.0))) - (1.0 / pow(x, 3.0)))) / ((1.0 / sqrt(x)) + (1.0 / sqrt((x + 1.0)))));
}
return VAR;
}




Bits error versus x
Results
| Original | 19.7 |
|---|---|
| Target | 0.7 |
| Herbie | 5.9 |
if x < 7117.860928874251Initial program 0.4
rmApplied add-cube-cbrt0.4
if 7117.860928874251 < x Initial program 39.7
rmApplied flip--39.7
Taylor expanded around inf 11.6
Simplified11.6
Final simplification5.9
herbie shell --seed 2020105
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:herbie-target
(/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1)))))
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))))