\sqrt{x + 1} - \sqrt{x}\sqrt{1} \cdot \frac{\sqrt{1}}{\sqrt{x + 1} + \sqrt{x}}double f(double x) {
double r346691 = x;
double r346692 = 1.0;
double r346693 = r346691 + r346692;
double r346694 = sqrt(r346693);
double r346695 = sqrt(r346691);
double r346696 = r346694 - r346695;
return r346696;
}
double f(double x) {
double r346697 = 1.0;
double r346698 = sqrt(r346697);
double r346699 = x;
double r346700 = r346699 + r346697;
double r346701 = sqrt(r346700);
double r346702 = sqrt(r346699);
double r346703 = r346701 + r346702;
double r346704 = r346698 / r346703;
double r346705 = r346698 * r346704;
return r346705;
}




Bits error versus x
Results
| Original | 29.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 29.3
rmApplied flip--29.1
Simplified0.2
rmApplied add-sqr-sqrt0.2
Applied sqrt-prod0.2
rmApplied *-un-lft-identity0.2
Applied add-sqr-sqrt0.2
Applied times-frac0.2
Simplified0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019326
(FPCore (x)
:name "Main:bigenough3 from C"
:precision binary64
:herbie-target
(/ 1 (+ (sqrt (+ x 1)) (sqrt x)))
(- (sqrt (+ x 1)) (sqrt x)))