Average Error: 4.0 → 0.1
Time: 10.0s
Precision: 64
$\left(a \cdot {x}^{2} + b \cdot x\right) + c$
$x \cdot \left(a \cdot x + b\right) + c$
\left(a \cdot {x}^{2} + b \cdot x\right) + c
x \cdot \left(a \cdot x + b\right) + c
double f(double a, double x, double b, double c) {
double r3550741 = a;
double r3550742 = x;
double r3550743 = 2.0;
double r3550744 = pow(r3550742, r3550743);
double r3550745 = r3550741 * r3550744;
double r3550746 = b;
double r3550747 = r3550746 * r3550742;
double r3550748 = r3550745 + r3550747;
double r3550749 = c;
double r3550750 = r3550748 + r3550749;
return r3550750;
}


double f(double a, double x, double b, double c) {
double r3550751 = x;
double r3550752 = a;
double r3550753 = r3550752 * r3550751;
double r3550754 = b;
double r3550755 = r3550753 + r3550754;
double r3550756 = r3550751 * r3550755;
double r3550757 = c;
double r3550758 = r3550756 + r3550757;
return r3550758;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 4.0

$\left(a \cdot {x}^{2} + b \cdot x\right) + c$
2. Simplified0.1

$\leadsto \color{blue}{\left(b + x \cdot a\right) \cdot x + c}$
3. Final simplification0.1

$\leadsto x \cdot \left(a \cdot x + b\right) + c$

# Reproduce

herbie shell --seed 1
(FPCore (a x b c)
:name "a*x^2+b*x+c"
(+ (+ (* a (pow x 2)) (* b x)) c))