Average Error: 0.2 → 0.2
Time: 9.3s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(6 - x \cdot 9\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\left(6 - x \cdot 9\right) \cdot x
double f(double x) {
        double r470399 = 3.0;
        double r470400 = 2.0;
        double r470401 = x;
        double r470402 = r470401 * r470399;
        double r470403 = r470400 - r470402;
        double r470404 = r470399 * r470403;
        double r470405 = r470404 * r470401;
        return r470405;
}

double f(double x) {
        double r470406 = 6.0;
        double r470407 = x;
        double r470408 = 9.0;
        double r470409 = r470407 * r470408;
        double r470410 = r470406 - r470409;
        double r470411 = r470410 * r470407;
        return r470411;
}

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. Simplified0.2

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

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

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

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

Reproduce

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