Average Error: 38.4 → 0.2
Time: 12.6s
Precision: 64
$\sqrt{1 + x} - 1$
$\frac{x}{1 + \sqrt{x + 1}}$
\sqrt{1 + x} - 1
\frac{x}{1 + \sqrt{x + 1}}
double f(double x) {
double r45482422 = 1.0;
double r45482423 = x;
double r45482424 = r45482422 + r45482423;
double r45482425 = sqrt(r45482424);
double r45482426 = r45482425 - r45482422;
return r45482426;
}


double f(double x) {
double r45482427 = x;
double r45482428 = 1.0;
double r45482429 = r45482427 + r45482428;
double r45482430 = sqrt(r45482429);
double r45482431 = r45482428 + r45482430;
double r45482432 = r45482427 / r45482431;
return r45482432;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 38.4

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

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

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

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

# Reproduce

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