Average Error: 0.1 → 0.1
Time: 1.5s
Precision: binary64
\[\left(\left(\left(1 + 0.5 \cdot x\right) - \left(0.125 \cdot x\right) \cdot x\right) + \left(\left(0.0625 \cdot x\right) \cdot x\right) \cdot x\right) - \left(\left(\left(0.0390625 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\]
\[\left({x}^{3} \cdot \left(0.0625 - 0.0390625 \cdot x\right) + 1\right) + x \cdot \left(0.5 - 0.125 \cdot x\right)\]
\left(\left(\left(1 + 0.5 \cdot x\right) - \left(0.125 \cdot x\right) \cdot x\right) + \left(\left(0.0625 \cdot x\right) \cdot x\right) \cdot x\right) - \left(\left(\left(0.0390625 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x
\left({x}^{3} \cdot \left(0.0625 - 0.0390625 \cdot x\right) + 1\right) + x \cdot \left(0.5 - 0.125 \cdot x\right)
double code(double x) {
	return ((double) (((double) (((double) (((double) (1.0 + ((double) (0.5 * x)))) - ((double) (((double) (0.125 * x)) * x)))) + ((double) (((double) (((double) (0.0625 * x)) * x)) * x)))) - ((double) (((double) (((double) (((double) (0.0390625 * x)) * x)) * x)) * x))));
}
double code(double x) {
	return ((double) (((double) (((double) (((double) pow(x, 3.0)) * ((double) (0.0625 - ((double) (0.0390625 * x)))))) + 1.0)) + ((double) (x * ((double) (0.5 - ((double) (0.125 * x))))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(1 + 0.5 \cdot x\right) - \left(0.125 \cdot x\right) \cdot x\right) + \left(\left(0.0625 \cdot x\right) \cdot x\right) \cdot x\right) - \left(\left(\left(0.0390625 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\left({x}^{3} \cdot \left(0.0625 - 0.0390625 \cdot x\right) + 1\right) + x \cdot \left(0.5 - 0.125 \cdot x\right)}\]
  3. Final simplification0.1

    \[\leadsto \left({x}^{3} \cdot \left(0.0625 - 0.0390625 \cdot x\right) + 1\right) + x \cdot \left(0.5 - 0.125 \cdot x\right)\]

Reproduce

herbie shell --seed 2020152 
(FPCore (x)
  :name "(- (+ (- (+ 1 (* 1/2 x)) (* (* 1/8 x) x)) (* (* (* 1/16 x) x) x)) (* (* (* (* 5/128 x) x) x) x))"
  :precision binary64
  (- (+ (- (+ 1.0 (* 0.5 x)) (* (* 0.125 x) x)) (* (* (* 0.0625 x) x) x)) (* (* (* (* 0.0390625 x) x) x) x)))