Average Error: 30.4 → 0.2
Time: 11.0s
Precision: 64
$\sqrt{x} - \sqrt{x + 1}$
$\frac{-1}{\sqrt{x} + \sqrt{1 + x}}$
\sqrt{x} - \sqrt{x + 1}
\frac{-1}{\sqrt{x} + \sqrt{1 + x}}
double f(double x) {
double r44983863 = x;
double r44983864 = sqrt(r44983863);
double r44983865 = 1.0;
double r44983866 = r44983863 + r44983865;
double r44983867 = sqrt(r44983866);
double r44983868 = r44983864 - r44983867;
return r44983868;
}


double f(double x) {
double r44983869 = 1.0;
double r44983870 = -r44983869;
double r44983871 = x;
double r44983872 = sqrt(r44983871);
double r44983873 = r44983869 + r44983871;
double r44983874 = sqrt(r44983873);
double r44983875 = r44983872 + r44983874;
double r44983876 = r44983870 / r44983875;
return r44983876;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 30.4

$\sqrt{x} - \sqrt{x + 1}$
2. Using strategy rm
3. Applied flip--30.2

$\leadsto \color{blue}{\frac{\sqrt{x} \cdot \sqrt{x} - \sqrt{x + 1} \cdot \sqrt{x + 1}}{\sqrt{x} + \sqrt{x + 1}}}$
4. Simplified0.2

$\leadsto \frac{\color{blue}{-1}}{\sqrt{x} + \sqrt{x + 1}}$
5. Final simplification0.2

$\leadsto \frac{-1}{\sqrt{x} + \sqrt{1 + x}}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "sqrt(x)-sqrt(x+1)"
(- (sqrt x) (sqrt (+ x 1.0))))