\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\begin{array}{l}
\mathbf{if}\;x \le 8.343787893268626 \cdot 10^{+200}:\\
\;\;\;\;{x}^{\frac{-1}{2}} - \frac{1}{\sqrt{1 + x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\frac{-1}{2}} \cdot \frac{1}{x} - \frac{\frac{1}{1 + x}}{\sqrt{1 + x}}}{\mathsf{fma}\left({x}^{\frac{-1}{2}}, {x}^{\frac{-1}{2}}, \frac{{x}^{\frac{-1}{2}}}{\sqrt{1 + x}}\right) + \frac{1}{1 + x}}\\
\end{array}double f(double x) {
double r5506535 = 1.0;
double r5506536 = x;
double r5506537 = sqrt(r5506536);
double r5506538 = r5506535 / r5506537;
double r5506539 = r5506536 + r5506535;
double r5506540 = sqrt(r5506539);
double r5506541 = r5506535 / r5506540;
double r5506542 = r5506538 - r5506541;
return r5506542;
}
double f(double x) {
double r5506543 = x;
double r5506544 = 8.343787893268626e+200;
bool r5506545 = r5506543 <= r5506544;
double r5506546 = -0.5;
double r5506547 = pow(r5506543, r5506546);
double r5506548 = 1.0;
double r5506549 = r5506548 + r5506543;
double r5506550 = sqrt(r5506549);
double r5506551 = r5506548 / r5506550;
double r5506552 = r5506547 - r5506551;
double r5506553 = r5506548 / r5506543;
double r5506554 = r5506547 * r5506553;
double r5506555 = r5506548 / r5506549;
double r5506556 = r5506555 / r5506550;
double r5506557 = r5506554 - r5506556;
double r5506558 = r5506547 / r5506550;
double r5506559 = fma(r5506547, r5506547, r5506558);
double r5506560 = r5506559 + r5506555;
double r5506561 = r5506557 / r5506560;
double r5506562 = r5506545 ? r5506552 : r5506561;
return r5506562;
}




Bits error versus x
| Original | 19.4 |
|---|---|
| Target | 0.7 |
| Herbie | 19.3 |
if x < 8.343787893268626e+200Initial program 22.5
rmApplied pow1/222.5
Applied pow-flip22.3
Simplified22.3
if 8.343787893268626e+200 < x Initial program 4.8
rmApplied pow1/24.8
Applied pow-flip20.1
Simplified20.1
rmApplied flip3--4.9
Simplified4.9
Simplified4.9
Final simplification19.3
herbie shell --seed 2019164 +o rules:numerics
(FPCore (x)
:name "2isqrt (example 3.6)"
:herbie-target
(/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1)))))
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))))