Average Error: 1.6 → 0
Time: 3.5s
Precision: 64
$\sqrt{x + 1} - \sqrt{x}$
$\frac{1}{\sqrt{x + 1} + \sqrt{x}}$
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
double f(double x) {
double r1596901 = x;
double r1596902 = 1.0;
double r1596903 = r1596901 + r1596902;
double r1596904 = sqrt(r1596903);
double r1596905 = sqrt(r1596901);
double r1596906 = r1596904 - r1596905;
return r1596906;
}


double f(double x) {
double r1596907 = 1.0;
double r1596908 = x;
double r1596909 = r1596908 + r1596907;
double r1596910 = sqrt(r1596909);
double r1596911 = sqrt(r1596908);
double r1596912 = r1596910 + r1596911;
double r1596913 = r1596907 / r1596912;
return r1596913;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 1.6

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

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

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

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

# Reproduce

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