\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\frac{\frac{1}{\frac{x}{1}}}{\frac{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}{\frac{1}{\frac{x + 1}{1}}}}(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (/ (/ 1.0 (/ x 1.0)) (/ (+ (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))) (/ 1.0 (/ (+ x 1.0) 1.0)))))
double code(double x) {
return ((double) ((1.0 / ((double) sqrt(x))) - (1.0 / ((double) sqrt(((double) (x + 1.0)))))));
}
double code(double x) {
return ((1.0 / (x / 1.0)) / (((double) ((1.0 / ((double) sqrt(x))) + (1.0 / ((double) sqrt(((double) (x + 1.0))))))) / (1.0 / (((double) (x + 1.0)) / 1.0))));
}




Bits error versus x
Results
| Original | 19.8 |
|---|---|
| Target | 0.7 |
| Herbie | 0.5 |
Initial program 19.8
rmApplied flip--_binary6419.8
Simplified19.8
Simplified19.8
rmApplied frac-sub_binary6419.2
Simplified19.2
Taylor expanded around 0 5.6
rmApplied *-un-lft-identity_binary645.6
Applied times-frac_binary645.1
Applied associate-/l*_binary640.5
Final simplification0.5
herbie shell --seed 2020205
(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)))))