Average Error: 0.3 → 0.2
Time: 6.2s
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 r437758 = 3.0;
        double r437759 = 2.0;
        double r437760 = x;
        double r437761 = r437760 * r437758;
        double r437762 = r437759 - r437761;
        double r437763 = r437758 * r437762;
        double r437764 = r437763 * r437760;
        return r437764;
}

double f(double x) {
        double r437765 = x;
        double r437766 = 6.0;
        double r437767 = 9.0;
        double r437768 = r437767 * r437765;
        double r437769 = r437766 - r437768;
        double r437770 = r437765 * r437769;
        return r437770;
}

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 2019303 
(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))