\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\frac{\frac{1 \cdot 1}{x + \sqrt{1 + x} \cdot \sqrt{x}}}{\sqrt{1 + x}}double f(double x) {
double r142666 = 1.0;
double r142667 = x;
double r142668 = sqrt(r142667);
double r142669 = r142666 / r142668;
double r142670 = r142667 + r142666;
double r142671 = sqrt(r142670);
double r142672 = r142666 / r142671;
double r142673 = r142669 - r142672;
return r142673;
}
double f(double x) {
double r142674 = 1.0;
double r142675 = r142674 * r142674;
double r142676 = x;
double r142677 = r142674 + r142676;
double r142678 = sqrt(r142677);
double r142679 = sqrt(r142676);
double r142680 = r142678 * r142679;
double r142681 = r142676 + r142680;
double r142682 = r142675 / r142681;
double r142683 = r142682 / r142678;
return r142683;
}




Bits error versus x
Results
| Original | 20.2 |
|---|---|
| Target | 0.7 |
| Herbie | 0.3 |
Initial program 20.2
rmApplied frac-sub20.2
Simplified20.2
Simplified20.2
rmApplied flip--20.0
Simplified0.4
rmApplied times-frac0.4
Simplified0.4
Simplified0.3
rmApplied pow10.3
Applied pow10.3
Applied pow-prod-down0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2019194
(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)))))