Average Error: 0.2 → 0.3
Time: 2.5s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[3 \cdot \left(\left(2 - x \cdot 3\right) \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
3 \cdot \left(\left(2 - x \cdot 3\right) \cdot x\right)
double f(double x) {
        double r687083 = 3.0;
        double r687084 = 2.0;
        double r687085 = x;
        double r687086 = r687085 * r687083;
        double r687087 = r687084 - r687086;
        double r687088 = r687083 * r687087;
        double r687089 = r687088 * r687085;
        return r687089;
}

double f(double x) {
        double r687090 = 3.0;
        double r687091 = 2.0;
        double r687092 = x;
        double r687093 = r687092 * r687090;
        double r687094 = r687091 - r687093;
        double r687095 = r687094 * r687092;
        double r687096 = r687090 * r687095;
        return r687096;
}

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.3
\[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. Final simplification0.3

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

Reproduce

herbie shell --seed 2020033 +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))