Average Error: 0.2 → 0.3
Time: 14.2s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[\frac{\left(2.0 \cdot 2.0 - 9.0 \cdot \left(x \cdot x\right)\right) \cdot 3.0}{x \cdot 3.0 + 2.0} \cdot x\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\frac{\left(2.0 \cdot 2.0 - 9.0 \cdot \left(x \cdot x\right)\right) \cdot 3.0}{x \cdot 3.0 + 2.0} \cdot x
double f(double x) {
        double r33600942 = 3.0;
        double r33600943 = 2.0;
        double r33600944 = x;
        double r33600945 = r33600944 * r33600942;
        double r33600946 = r33600943 - r33600945;
        double r33600947 = r33600942 * r33600946;
        double r33600948 = r33600947 * r33600944;
        return r33600948;
}

double f(double x) {
        double r33600949 = 2.0;
        double r33600950 = r33600949 * r33600949;
        double r33600951 = 9.0;
        double r33600952 = x;
        double r33600953 = r33600952 * r33600952;
        double r33600954 = r33600951 * r33600953;
        double r33600955 = r33600950 - r33600954;
        double r33600956 = 3.0;
        double r33600957 = r33600955 * r33600956;
        double r33600958 = r33600952 * r33600956;
        double r33600959 = r33600958 + r33600949;
        double r33600960 = r33600957 / r33600959;
        double r33600961 = r33600960 * r33600952;
        return r33600961;
}

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.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. Using strategy rm
  3. Applied flip--0.3

    \[\leadsto \left(3.0 \cdot \color{blue}{\frac{2.0 \cdot 2.0 - \left(x \cdot 3.0\right) \cdot \left(x \cdot 3.0\right)}{2.0 + x \cdot 3.0}}\right) \cdot x\]
  4. Applied associate-*r/0.3

    \[\leadsto \color{blue}{\frac{3.0 \cdot \left(2.0 \cdot 2.0 - \left(x \cdot 3.0\right) \cdot \left(x \cdot 3.0\right)\right)}{2.0 + x \cdot 3.0}} \cdot x\]
  5. Taylor expanded around 0 0.3

    \[\leadsto \frac{3.0 \cdot \left(2.0 \cdot 2.0 - \color{blue}{9.0 \cdot {x}^{2}}\right)}{2.0 + x \cdot 3.0} \cdot x\]
  6. Simplified0.3

    \[\leadsto \frac{3.0 \cdot \left(2.0 \cdot 2.0 - \color{blue}{9.0 \cdot \left(x \cdot x\right)}\right)}{2.0 + x \cdot 3.0} \cdot x\]
  7. Final simplification0.3

    \[\leadsto \frac{\left(2.0 \cdot 2.0 - 9.0 \cdot \left(x \cdot x\right)\right) \cdot 3.0}{x \cdot 3.0 + 2.0} \cdot x\]

Reproduce

herbie shell --seed 2019164 
(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))