Average Error: 0.2 → 0.2
Time: 9.8s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot \left(6 - x \cdot 9\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 - x \cdot 9\right)
double f(double x) {
        double r902885 = 3.0;
        double r902886 = 2.0;
        double r902887 = x;
        double r902888 = r902887 * r902885;
        double r902889 = r902886 - r902888;
        double r902890 = r902885 * r902889;
        double r902891 = r902890 * r902887;
        return r902891;
}

double f(double x) {
        double r902892 = x;
        double r902893 = 6.0;
        double r902894 = 9.0;
        double r902895 = r902892 * r902894;
        double r902896 = r902893 - r902895;
        double r902897 = r902892 * r902896;
        return r902897;
}

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. Using strategy rm
  3. Applied associate-*l*0.3

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

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

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

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

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(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))