Average Error: 0.3 → 0.2
Time: 10.8s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(3 \cdot 2 + x \cdot \left(3 \cdot \left(-3\right)\right)\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\left(3 \cdot 2 + x \cdot \left(3 \cdot \left(-3\right)\right)\right) \cdot x
double f(double x) {
        double r788720 = 3.0;
        double r788721 = 2.0;
        double r788722 = x;
        double r788723 = r788722 * r788720;
        double r788724 = r788721 - r788723;
        double r788725 = r788720 * r788724;
        double r788726 = r788725 * r788722;
        return r788726;
}

double f(double x) {
        double r788727 = 3.0;
        double r788728 = 2.0;
        double r788729 = r788727 * r788728;
        double r788730 = x;
        double r788731 = -r788727;
        double r788732 = r788727 * r788731;
        double r788733 = r788730 * r788732;
        double r788734 = r788729 + r788733;
        double r788735 = r788734 * r788730;
        return r788735;
}

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. Using strategy rm
  3. Applied sub-neg0.3

    \[\leadsto \left(3 \cdot \color{blue}{\left(2 + \left(-x \cdot 3\right)\right)}\right) \cdot x\]
  4. Applied distribute-lft-in0.2

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

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

    \[\leadsto \left(3 \cdot 2 + x \cdot \left(3 \cdot \left(-3\right)\right)\right) \cdot x\]

Reproduce

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