Average Error: 0.3 → 0.3
Time: 15.2s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[\left(\left(2.0 - 3.0 \cdot x\right) \cdot x\right) \cdot 3.0\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\left(\left(2.0 - 3.0 \cdot x\right) \cdot x\right) \cdot 3.0
double f(double x) {
        double r31835904 = 3.0;
        double r31835905 = 2.0;
        double r31835906 = x;
        double r31835907 = r31835906 * r31835904;
        double r31835908 = r31835905 - r31835907;
        double r31835909 = r31835904 * r31835908;
        double r31835910 = r31835909 * r31835906;
        return r31835910;
}

double f(double x) {
        double r31835911 = 2.0;
        double r31835912 = 3.0;
        double r31835913 = x;
        double r31835914 = r31835912 * r31835913;
        double r31835915 = r31835911 - r31835914;
        double r31835916 = r31835915 * r31835913;
        double r31835917 = r31835916 * r31835912;
        return r31835917;
}

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

Derivation

  1. Initial program 0.3

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

    \[\leadsto \color{blue}{3.0 \cdot \left(\left(2.0 - x \cdot 3.0\right) \cdot x\right)}\]
  4. Final simplification0.3

    \[\leadsto \left(\left(2.0 - 3.0 \cdot x\right) \cdot x\right) \cdot 3.0\]

Reproduce

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