\frac{1.0}{\sqrt{x}} - \frac{1.0}{\sqrt{x + 1.0}}\frac{\sqrt{1.0}}{x} \cdot \frac{\frac{\sqrt{1.0}}{\frac{1.0}{\sqrt{x}} + \frac{1.0}{\sqrt{1.0 + x}}}}{1.0 + x}double f(double x) {
double r4757545 = 1.0;
double r4757546 = x;
double r4757547 = sqrt(r4757546);
double r4757548 = r4757545 / r4757547;
double r4757549 = r4757546 + r4757545;
double r4757550 = sqrt(r4757549);
double r4757551 = r4757545 / r4757550;
double r4757552 = r4757548 - r4757551;
return r4757552;
}
double f(double x) {
double r4757553 = 1.0;
double r4757554 = sqrt(r4757553);
double r4757555 = x;
double r4757556 = r4757554 / r4757555;
double r4757557 = sqrt(r4757555);
double r4757558 = r4757553 / r4757557;
double r4757559 = r4757553 + r4757555;
double r4757560 = sqrt(r4757559);
double r4757561 = r4757553 / r4757560;
double r4757562 = r4757558 + r4757561;
double r4757563 = r4757554 / r4757562;
double r4757564 = r4757563 / r4757559;
double r4757565 = r4757556 * r4757564;
return r4757565;
}




Bits error versus x
Results
| Original | 20.0 |
|---|---|
| Target | 0.7 |
| Herbie | 0.4 |
Initial program 20.0
rmApplied flip--20.1
rmApplied frac-times25.2
Applied frac-times20.1
Applied frac-sub19.9
Taylor expanded around 0 6.0
rmApplied *-un-lft-identity6.0
Applied add-sqr-sqrt6.0
Applied times-frac5.6
Applied times-frac0.6
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019165
(FPCore (x)
:name "2isqrt (example 3.6)"
:herbie-target
(/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))