Average Error: 21.6 → 0.1
Time: 11.7s
Precision: 64
$\frac{{\left(x + 1\right)}^{2}}{{x}^{2}}$
$\left(\frac{2}{x} + 1\right) + \frac{\frac{1}{x}}{x}$
\frac{{\left(x + 1\right)}^{2}}{{x}^{2}}
\left(\frac{2}{x} + 1\right) + \frac{\frac{1}{x}}{x}
double f(double x) {
double r830186 = x;
double r830187 = 1.0;
double r830188 = r830186 + r830187;
double r830189 = 2.0;
double r830190 = pow(r830188, r830189);
double r830191 = pow(r830186, r830189);
double r830192 = r830190 / r830191;
return r830192;
}

double f(double x) {
double r830193 = 2.0;
double r830194 = x;
double r830195 = r830193 / r830194;
double r830196 = 1.0;
double r830197 = r830195 + r830196;
double r830198 = 1.0;
double r830199 = r830198 / r830194;
double r830200 = r830199 / r830194;
double r830201 = r830197 + r830200;
return r830201;
}

Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Initial program 21.6

$\frac{{\left(x + 1\right)}^{2}}{{x}^{2}}$
2. Taylor expanded around inf 0.1

$\leadsto \color{blue}{2 \cdot \frac{1}{x} + \left(1 \cdot \frac{1}{{x}^{2}} + 1\right)}$
3. Simplified0.1

$\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} + 1\right) + \frac{2}{x}}$
4. Taylor expanded around 0 0.1

$\leadsto \color{blue}{1 \cdot \frac{1}{{x}^{2}} + \left(2 \cdot \frac{1}{x} + 1\right)}$
5. Simplified0.1

$\leadsto \color{blue}{\left(\frac{2}{x} + 1\right) + \frac{\frac{1}{x}}{x}}$
6. Final simplification0.1

$\leadsto \left(\frac{2}{x} + 1\right) + \frac{\frac{1}{x}}{x}$

Reproduce

herbie shell --seed 1
(FPCore (x)
:name "pow(x + 1, 2) / pow(x, 2)"
:precision binary64
(/ (pow (+ x 1) 2) (pow x 2)))