Average Error: 0.3 → 0.2
Time: 2.6s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot \left(6 - 9 \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 - 9 \cdot x\right)
double f(double x) {
        double r658843 = 3.0;
        double r658844 = 2.0;
        double r658845 = x;
        double r658846 = r658845 * r658843;
        double r658847 = r658844 - r658846;
        double r658848 = r658843 * r658847;
        double r658849 = r658848 * r658845;
        return r658849;
}

double f(double x) {
        double r658850 = x;
        double r658851 = 6.0;
        double r658852 = 9.0;
        double r658853 = r658852 * r658850;
        double r658854 = r658851 - r658853;
        double r658855 = r658850 * r658854;
        return r658855;
}

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.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.3

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Taylor expanded around 0 0.2

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

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

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

Reproduce

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