Average Error: 0.0 → 0.0
Time: 1.1s
Precision: binary64
Cost: 448
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[x \cdot \left(x \cdot -0.5 + 1\right)\]
x \cdot \left(1 - x \cdot 0.5\right)
x \cdot \left(x \cdot -0.5 + 1\right)
(FPCore (x) :precision binary64 (* x (- 1.0 (* x 0.5))))
(FPCore (x) :precision binary64 (* x (+ (* x -0.5) 1.0)))
double code(double x) {
	return x * (1.0 - (x * 0.5));
}
double code(double x) {
	return x * ((x * -0.5) + 1.0);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error1.8
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9962462755982668 \lor \neg \left(x \leq 1.9880028589630472\right):\\ \;\;\;\;x \cdot \left(x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 2
Error22.1
Cost64
\[x\]
Alternative 3
Error61.3
Cost64
\[0\]
Alternative 4
Error62.1
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x \cdot \left(1 - x \cdot 0.5\right)\]
  2. Simplified0.0

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

    \[\leadsto x \cdot \left(x \cdot -0.5 + 1\right)\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (- 1.0 (* x 0.5))))