Average Error: 0.1 → 0.1
Time: 14.3s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + x \cdot \left(x \cdot 9 - 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + x \cdot \left(x \cdot 9 - 12\right)
double f(double x) {
        double r549735 = 3.0;
        double r549736 = x;
        double r549737 = r549736 * r549735;
        double r549738 = r549737 * r549736;
        double r549739 = 4.0;
        double r549740 = r549736 * r549739;
        double r549741 = r549738 - r549740;
        double r549742 = 1.0;
        double r549743 = r549741 + r549742;
        double r549744 = r549735 * r549743;
        return r549744;
}

double f(double x) {
        double r549745 = 3.0;
        double r549746 = x;
        double r549747 = 9.0;
        double r549748 = r549746 * r549747;
        double r549749 = 12.0;
        double r549750 = r549748 - r549749;
        double r549751 = r549746 * r549750;
        double r549752 = r549745 + r549751;
        return r549752;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Derivation

  1. Initial program 0.1

    \[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{3 \cdot \left(1 + x \cdot \left(x \cdot 3 - 4\right)\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  4. Simplified0.1

    \[\leadsto \color{blue}{3 + x \cdot \left(x \cdot 9 - 12\right)}\]
  5. Final simplification0.1

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

Reproduce

herbie shell --seed 2019303 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (+ 3 (- (* (* 9 x) x) (* 12 x)))

  (* 3 (+ (- (* (* x 3) x) (* x 4)) 1)))