Average Error: 0.2 → 0.2
Time: 1.5s
Precision: binary64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[3 \cdot \left(x \cdot 2\right) - \left(3 \cdot 3\right) \cdot \left(x \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
3 \cdot \left(x \cdot 2\right) - \left(3 \cdot 3\right) \cdot \left(x \cdot x\right)
double code(double x) {
	return ((double) (((double) (3.0 * ((double) (2.0 - ((double) (x * 3.0)))))) * x));
}
double code(double x) {
	return ((double) (((double) (3.0 * ((double) (x * 2.0)))) - ((double) (((double) (3.0 * 3.0)) * ((double) (x * x))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.2
Herbie0.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program Error: 0.2 bits

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. SimplifiedError: 0.2 bits

    \[\leadsto \color{blue}{3 \cdot \left(x \cdot \left(2 - 3 \cdot x\right)\right)}\]
  3. Using strategy rm
  4. Applied sub-negError: 0.2 bits

    \[\leadsto 3 \cdot \left(x \cdot \color{blue}{\left(2 + \left(-3 \cdot x\right)\right)}\right)\]
  5. Applied distribute-lft-inError: 0.2 bits

    \[\leadsto 3 \cdot \color{blue}{\left(x \cdot 2 + x \cdot \left(-3 \cdot x\right)\right)}\]
  6. Applied distribute-lft-inError: 0.2 bits

    \[\leadsto \color{blue}{3 \cdot \left(x \cdot 2\right) + 3 \cdot \left(x \cdot \left(-3 \cdot x\right)\right)}\]
  7. SimplifiedError: 0.3 bits

    \[\leadsto 3 \cdot \left(x \cdot 2\right) + \color{blue}{3 \cdot \left(3 \cdot \left(x \cdot \left(-x\right)\right)\right)}\]
  8. Using strategy rm
  9. Applied associate-*r*Error: 0.2 bits

    \[\leadsto 3 \cdot \left(x \cdot 2\right) + \color{blue}{\left(3 \cdot 3\right) \cdot \left(x \cdot \left(-x\right)\right)}\]
  10. Final simplificationError: 0.2 bits

    \[\leadsto 3 \cdot \left(x \cdot 2\right) - \left(3 \cdot 3\right) \cdot \left(x \cdot x\right)\]

Reproduce

herbie shell --seed 2020200 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
  :precision binary64

  :herbie-target
  (- (* 6.0 x) (* 9.0 (* x x)))

  (* (* 3.0 (- 2.0 (* x 3.0))) x))