\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 Error: 19.8 bits
rmApplied flip--Error: 19.8 bits
SimplifiedError: 19.8 bits
SimplifiedError: 19.8 bits
rmApplied frac-subError: 19.2 bits
SimplifiedError: 19.2 bits
Taylor expanded around 0 Error: 5.6 bits
rmApplied *-un-lft-identityError: 5.6 bits
Applied times-fracError: 5.1 bits
Applied associate-/l*Error: 0.5 bits
Final simplificationError: 0.5 bits
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)))))