Average Error: 0.2 → 0.2
Time: 6.5s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[x \cdot 6.0 - \left(x \cdot x\right) \cdot 9.0\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
x \cdot 6.0 - \left(x \cdot x\right) \cdot 9.0
double f(double x) {
        double r14379678 = 3.0;
        double r14379679 = 2.0;
        double r14379680 = x;
        double r14379681 = r14379680 * r14379678;
        double r14379682 = r14379679 - r14379681;
        double r14379683 = r14379678 * r14379682;
        double r14379684 = r14379683 * r14379680;
        return r14379684;
}

double f(double x) {
        double r14379685 = x;
        double r14379686 = 6.0;
        double r14379687 = r14379685 * r14379686;
        double r14379688 = r14379685 * r14379685;
        double r14379689 = 9.0;
        double r14379690 = r14379688 * r14379689;
        double r14379691 = r14379687 - r14379690;
        return r14379691;
}

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.0 \cdot x - 9.0 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
  2. Using strategy rm
  3. Applied associate-*l*0.2

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

    \[\leadsto \color{blue}{6.0 \cdot x - 9.0 \cdot {x}^{2}}\]
  5. Simplified0.2

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

    \[\leadsto x \cdot 6.0 - \left(x \cdot x\right) \cdot 9.0\]

Reproduce

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