Average Error: 29.8 → 0.2
Time: 12.2s
Precision: 64
$x \gt 0$
$\sqrt{x + 1} - \sqrt{x}$
$\frac{1}{\sqrt{1 + x} + \sqrt{x}}$
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{1 + x} + \sqrt{x}}
double f(double x) {
double r59743046 = x;
double r59743047 = 1.0;
double r59743048 = r59743046 + r59743047;
double r59743049 = sqrt(r59743048);
double r59743050 = sqrt(r59743046);
double r59743051 = r59743049 - r59743050;
return r59743051;
}


double f(double x) {
double r59743052 = 1.0;
double r59743053 = x;
double r59743054 = r59743052 + r59743053;
double r59743055 = sqrt(r59743054);
double r59743056 = sqrt(r59743053);
double r59743057 = r59743055 + r59743056;
double r59743058 = r59743052 / r59743057;
return r59743058;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 29.8

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

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

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

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

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "sqrt(x + 1) - sqrt(x)"
:pre (> x 0)
(- (sqrt (+ x 1)) (sqrt x)))