Average Error: 0.1 → 0.1
Time: 13.4s
Precision: 64
$\left(\left(\frac{5}{4} \cdot b\right) \cdot b - 2 \cdot b\right) + 1$
$\left(\left(b \cdot b\right) \cdot \frac{5}{4} - b \cdot 2\right) + 1$
\left(\left(\frac{5}{4} \cdot b\right) \cdot b - 2 \cdot b\right) + 1
\left(\left(b \cdot b\right) \cdot \frac{5}{4} - b \cdot 2\right) + 1
double f(double b) {
double r3744971 = 5.0;
double r3744972 = 4.0;
double r3744973 = r3744971 / r3744972;
double r3744974 = b;
double r3744975 = r3744973 * r3744974;
double r3744976 = r3744975 * r3744974;
double r3744977 = 2.0;
double r3744978 = r3744977 * r3744974;
double r3744979 = r3744976 - r3744978;
double r3744980 = 1.0;
double r3744981 = r3744979 + r3744980;
return r3744981;
}


double f(double b) {
double r3744982 = b;
double r3744983 = r3744982 * r3744982;
double r3744984 = 5.0;
double r3744985 = 4.0;
double r3744986 = r3744984 / r3744985;
double r3744987 = r3744983 * r3744986;
double r3744988 = 2.0;
double r3744989 = r3744982 * r3744988;
double r3744990 = r3744987 - r3744989;
double r3744991 = 1.0;
double r3744992 = r3744990 + r3744991;
return r3744992;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$\left(\left(\frac{5}{4} \cdot b\right) \cdot b - 2 \cdot b\right) + 1$
2. Using strategy rm
3. Applied associate-*l*0.1

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

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

# Reproduce

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