Average Error: 0.1 → 0.1
Time: 10.4s
Precision: 64
$1 - \frac{x}{2} \cdot \left(1 - \frac{x}{3} \cdot \left(1 - \frac{x}{4}\right)\right)$
$1 - \frac{x}{2} \cdot \left(1 - x \cdot \frac{1 - \frac{x}{4}}{3}\right)$
1 - \frac{x}{2} \cdot \left(1 - \frac{x}{3} \cdot \left(1 - \frac{x}{4}\right)\right)
1 - \frac{x}{2} \cdot \left(1 - x \cdot \frac{1 - \frac{x}{4}}{3}\right)
double f(double x) {
double r741342 = 1.0;
double r741343 = x;
double r741344 = 2.0;
double r741345 = r741343 / r741344;
double r741346 = 3.0;
double r741347 = r741343 / r741346;
double r741348 = 4.0;
double r741349 = r741343 / r741348;
double r741350 = r741342 - r741349;
double r741351 = r741347 * r741350;
double r741352 = r741342 - r741351;
double r741353 = r741345 * r741352;
double r741354 = r741342 - r741353;
return r741354;
}


double f(double x) {
double r741355 = 1.0;
double r741356 = x;
double r741357 = 2.0;
double r741358 = r741356 / r741357;
double r741359 = 4.0;
double r741360 = r741356 / r741359;
double r741361 = r741355 - r741360;
double r741362 = 3.0;
double r741363 = r741361 / r741362;
double r741364 = r741356 * r741363;
double r741365 = r741355 - r741364;
double r741366 = r741358 * r741365;
double r741367 = r741355 - r741366;
return r741367;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$1 - \frac{x}{2} \cdot \left(1 - \frac{x}{3} \cdot \left(1 - \frac{x}{4}\right)\right)$
2. Using strategy rm
3. Applied div-inv0.1

$\leadsto 1 - \frac{x}{2} \cdot \left(1 - \color{blue}{\left(x \cdot \frac{1}{3}\right)} \cdot \left(1 - \frac{x}{4}\right)\right)$
4. Applied associate-*l*0.1

$\leadsto 1 - \frac{x}{2} \cdot \left(1 - \color{blue}{x \cdot \left(\frac{1}{3} \cdot \left(1 - \frac{x}{4}\right)\right)}\right)$
5. Simplified0.1

$\leadsto 1 - \frac{x}{2} \cdot \left(1 - x \cdot \color{blue}{\frac{1 - \frac{x}{4}}{3}}\right)$
6. Final simplification0.1

$\leadsto 1 - \frac{x}{2} \cdot \left(1 - x \cdot \frac{1 - \frac{x}{4}}{3}\right)$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "1 - (x/2)(1 - (x/3)(1 - (x/4)))"
:precision binary64
(- 1 (* (/ x 2) (- 1 (* (/ x 3) (- 1 (/ x 4)))))))