Average Error: 2.7 → 1.0
Time: 2.2s
Precision: binary64
\[\left(\left(k0 + x \cdot k1\right) + \left(x \cdot x\right) \cdot k2\right) + \left(\left(x \cdot x\right) \cdot x\right) \cdot k3\]
\[x \cdot k1 + \left(k0 + \left(x \cdot x\right) \cdot \left(k2 + x \cdot k3\right)\right)\]
\left(\left(k0 + x \cdot k1\right) + \left(x \cdot x\right) \cdot k2\right) + \left(\left(x \cdot x\right) \cdot x\right) \cdot k3
x \cdot k1 + \left(k0 + \left(x \cdot x\right) \cdot \left(k2 + x \cdot k3\right)\right)
double code(double k0, double x, double k1, double k2, double k3) {
	return ((double) (((double) (((double) (k0 + ((double) (x * k1)))) + ((double) (((double) (x * x)) * k2)))) + ((double) (((double) (((double) (x * x)) * x)) * k3))));
}
double code(double k0, double x, double k1, double k2, double k3) {
	return ((double) (((double) (x * k1)) + ((double) (k0 + ((double) (((double) (x * x)) * ((double) (k2 + ((double) (x * k3))))))))));
}

Error

Bits error versus k0

Bits error versus x

Bits error versus k1

Bits error versus k2

Bits error versus k3

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 2.7

    \[\left(\left(k0 + x \cdot k1\right) + \left(x \cdot x\right) \cdot k2\right) + \left(\left(x \cdot x\right) \cdot x\right) \cdot k3\]
  2. Simplified1.0

    \[\leadsto \color{blue}{x \cdot k1 + \left(k0 + \left(x \cdot x\right) \cdot \left(k2 + x \cdot k3\right)\right)}\]
  3. Final simplification1.0

    \[\leadsto x \cdot k1 + \left(k0 + \left(x \cdot x\right) \cdot \left(k2 + x \cdot k3\right)\right)\]

Reproduce

herbie shell --seed 2020153 
(FPCore (k0 x k1 k2 k3)
  :name "(+ (+ (+ k0 (* x k1)) (* (* x x) k2)) (* (* (* x x) x) k3))"
  :precision binary64
  (+ (+ (+ k0 (* x k1)) (* (* x x) k2)) (* (* (* x x) x) k3)))