Average Error: 0.1 → 0.1
Time: 13.3s
Precision: 64
$b \cdot \left(\frac{b \cdot 5}{4} - 2\right) + 1$
$\left(1.25 \cdot \left(b \cdot b\right) - b \cdot 2\right) + 1$
b \cdot \left(\frac{b \cdot 5}{4} - 2\right) + 1
\left(1.25 \cdot \left(b \cdot b\right) - b \cdot 2\right) + 1
double f(double b) {
double r3185897 = b;
double r3185898 = 5.0;
double r3185899 = r3185897 * r3185898;
double r3185900 = 4.0;
double r3185901 = r3185899 / r3185900;
double r3185902 = 2.0;
double r3185903 = r3185901 - r3185902;
double r3185904 = r3185897 * r3185903;
double r3185905 = 1.0;
double r3185906 = r3185904 + r3185905;
return r3185906;
}


double f(double b) {
double r3185907 = 1.25;
double r3185908 = b;
double r3185909 = r3185908 * r3185908;
double r3185910 = r3185907 * r3185909;
double r3185911 = 2.0;
double r3185912 = r3185908 * r3185911;
double r3185913 = r3185910 - r3185912;
double r3185914 = 1.0;
double r3185915 = r3185913 + r3185914;
return r3185915;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$b \cdot \left(\frac{b \cdot 5}{4} - 2\right) + 1$
2. Using strategy rm
3. Applied sub-neg0.1

$\leadsto b \cdot \color{blue}{\left(\frac{b \cdot 5}{4} + \left(-2\right)\right)} + 1$
4. Applied distribute-rgt-in0.1

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

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

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

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

# Reproduce

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