Average Error: 0.3 → 0.2
Time: 1.9s
Precision: binary64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(3 \cdot 2 + 3 \cdot \left(-x \cdot 3\right)\right) \cdot x\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 0.3

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Using strategy rm
  3. Applied sub-neg0.3

    \[\leadsto \left(3 \cdot \color{blue}{\left(2 + \left(-x \cdot 3\right)\right)}\right) \cdot x\]
  4. Applied distribute-lft-in0.2

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

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

Reproduce

herbie shell --seed 2020169 
(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))