Average Error: 0.2 → 0.2
Time: 13.8s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[\left(6.0 - x \cdot 9.0\right) \cdot x\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\left(6.0 - x \cdot 9.0\right) \cdot x
double f(double x) {
        double r25065962 = 3.0;
        double r25065963 = 2.0;
        double r25065964 = x;
        double r25065965 = r25065964 * r25065962;
        double r25065966 = r25065963 - r25065965;
        double r25065967 = r25065962 * r25065966;
        double r25065968 = r25065967 * r25065964;
        return r25065968;
}

double f(double x) {
        double r25065969 = 6.0;
        double r25065970 = x;
        double r25065971 = 9.0;
        double r25065972 = r25065970 * r25065971;
        double r25065973 = r25065969 - r25065972;
        double r25065974 = r25065973 * r25065970;
        return r25065974;
}

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. Taylor expanded around 0 0.2

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

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

Reproduce

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