Average Error: 0.2 → 0.2
Time: 9.9s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot 6 + \left(-9\right) \cdot \left(x \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot 6 + \left(-9\right) \cdot \left(x \cdot x\right)
double f(double x) {
        double r530651 = 3.0;
        double r530652 = 2.0;
        double r530653 = x;
        double r530654 = r530653 * r530651;
        double r530655 = r530652 - r530654;
        double r530656 = r530651 * r530655;
        double r530657 = r530656 * r530653;
        return r530657;
}

double f(double x) {
        double r530658 = x;
        double r530659 = 6.0;
        double r530660 = r530658 * r530659;
        double r530661 = 9.0;
        double r530662 = -r530661;
        double r530663 = r530658 * r530658;
        double r530664 = r530662 * r530663;
        double r530665 = r530660 + r530664;
        return r530665;
}

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 0.2

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

    \[\leadsto \color{blue}{x \cdot \left(\left(2 - 3 \cdot x\right) \cdot 3\right)}\]
  3. Taylor expanded around 0 0.2

    \[\leadsto x \cdot \color{blue}{\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. Simplified0.2

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

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

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

Reproduce

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

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

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