Average Error: 0.3 → 0.2
Time: 8.8s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[6 \cdot x - 9 \cdot {x}^{2}\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
6 \cdot x - 9 \cdot {x}^{2}
double f(double x) {
        double r648917 = 3.0;
        double r648918 = 2.0;
        double r648919 = x;
        double r648920 = r648919 * r648917;
        double r648921 = r648918 - r648920;
        double r648922 = r648917 * r648921;
        double r648923 = r648922 * r648919;
        return r648923;
}

double f(double x) {
        double r648924 = 6.0;
        double r648925 = x;
        double r648926 = r648924 * r648925;
        double r648927 = 9.0;
        double r648928 = 2.0;
        double r648929 = pow(r648925, r648928);
        double r648930 = r648927 * r648929;
        double r648931 = r648926 - r648930;
        return r648931;
}

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}{\left(6 - 9 \cdot x\right)} \cdot x\]
  3. Using strategy rm
  4. Applied flip--0.3

    \[\leadsto \color{blue}{\frac{6 \cdot 6 - \left(9 \cdot x\right) \cdot \left(9 \cdot x\right)}{6 + 9 \cdot x}} \cdot x\]
  5. Simplified0.3

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, 9, 6\right) \cdot \left(6 - 9 \cdot x\right)}}{6 + 9 \cdot x} \cdot x\]
  6. Simplified0.3

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

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  8. Final simplification0.2

    \[\leadsto 6 \cdot x - 9 \cdot {x}^{2}\]

Reproduce

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