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




Bits error versus x
Results
| Original | 19.4 |
|---|---|
| Target | 0.6 |
| Herbie | 0.3 |
Initial program 19.4
rmApplied frac-sub_binary6419.4
Simplified19.4
Simplified19.4
rmApplied flip--_binary6419.2
Simplified0.4
rmApplied times-frac_binary640.4
Simplified0.3
rmApplied div-inv_binary640.3
Applied associate-*l*_binary640.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2020210
(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)))))