Average Error: 0.2 → 0.1
Time: 9.1s
Precision: 64
$\left(1 + 2 \cdot b\right) + \frac{\left(b \cdot b\right) \cdot 5}{4}$
$1 + \left(2 \cdot b + \left(b \cdot b\right) \cdot 1.25\right)$
\left(1 + 2 \cdot b\right) + \frac{\left(b \cdot b\right) \cdot 5}{4}
1 + \left(2 \cdot b + \left(b \cdot b\right) \cdot 1.25\right)
double f(double b) {
double r4220431 = 1.0;
double r4220432 = 2.0;
double r4220433 = b;
double r4220434 = r4220432 * r4220433;
double r4220435 = r4220431 + r4220434;
double r4220436 = r4220433 * r4220433;
double r4220437 = 5.0;
double r4220438 = r4220436 * r4220437;
double r4220439 = 4.0;
double r4220440 = r4220438 / r4220439;
double r4220441 = r4220435 + r4220440;
return r4220441;
}


double f(double b) {
double r4220442 = 1.0;
double r4220443 = 2.0;
double r4220444 = b;
double r4220445 = r4220443 * r4220444;
double r4220446 = r4220444 * r4220444;
double r4220447 = 1.25;
double r4220448 = r4220446 * r4220447;
double r4220449 = r4220445 + r4220448;
double r4220450 = r4220442 + r4220449;
return r4220450;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.2

$\left(1 + 2 \cdot b\right) + \frac{\left(b \cdot b\right) \cdot 5}{4}$
2. Simplified0.1

$\leadsto \color{blue}{1 + \left(\frac{5}{\frac{4}{b}} + 2\right) \cdot b}$
3. Taylor expanded around 0 0.1

$\leadsto 1 + \color{blue}{\left(2 \cdot b + 1.25 \cdot {b}^{2}\right)}$
4. Simplified0.1

$\leadsto 1 + \color{blue}{\left(b \cdot 2 + b \cdot \left(b \cdot 1.25\right)\right)}$
5. Using strategy rm
6. Applied associate-*r*0.1

$\leadsto 1 + \left(b \cdot 2 + \color{blue}{\left(b \cdot b\right) \cdot 1.25}\right)$
7. Final simplification0.1

$\leadsto 1 + \left(2 \cdot b + \left(b \cdot b\right) \cdot 1.25\right)$

# Reproduce

herbie shell --seed 1
(FPCore (b)
:name "1 + (2 * b) + ((b * b) * 5) / 4"
(+ (+ 1.0 (* 2.0 b)) (/ (* (* b b) 5.0) 4.0)))