Average Error: 0.3 → 0.2
Time: 9.2s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[6 \cdot x + \left(-9 \cdot x\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
6 \cdot x + \left(-9 \cdot x\right) \cdot x
double f(double x) {
        double r456681 = 3.0;
        double r456682 = 2.0;
        double r456683 = x;
        double r456684 = r456683 * r456681;
        double r456685 = r456682 - r456684;
        double r456686 = r456681 * r456685;
        double r456687 = r456686 * r456683;
        return r456687;
}

double f(double x) {
        double r456688 = 6.0;
        double r456689 = x;
        double r456690 = r456688 * r456689;
        double r456691 = 9.0;
        double r456692 = r456691 * r456689;
        double r456693 = -r456692;
        double r456694 = r456693 * r456689;
        double r456695 = r456690 + r456694;
        return r456695;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  3. Simplified0.2

    \[\leadsto \color{blue}{x \cdot \left(6 - 9 \cdot x\right)}\]
  4. Using strategy rm
  5. Applied sub-neg0.2

    \[\leadsto x \cdot \color{blue}{\left(6 + \left(-9 \cdot x\right)\right)}\]
  6. Applied distribute-rgt-in0.2

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

    \[\leadsto 6 \cdot x + \left(-9 \cdot x\right) \cdot x\]

Reproduce

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

  :herbie-target
  (- (* 6 x) (* 9 (* x x)))

  (* (* 3 (- 2 (* x 3))) x))