Average Error: 0.2 → 0.1
Time: 2.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(x \cdot 9 - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(x \cdot 9 - 12\right) + 3
double f(double x) {
        double r893740 = 3.0;
        double r893741 = x;
        double r893742 = r893741 * r893740;
        double r893743 = r893742 * r893741;
        double r893744 = 4.0;
        double r893745 = r893741 * r893744;
        double r893746 = r893743 - r893745;
        double r893747 = 1.0;
        double r893748 = r893746 + r893747;
        double r893749 = r893740 * r893748;
        return r893749;
}

double f(double x) {
        double r893750 = x;
        double r893751 = 9.0;
        double r893752 = r893750 * r893751;
        double r893753 = 12.0;
        double r893754 = r893752 - r893753;
        double r893755 = r893750 * r893754;
        double r893756 = 3.0;
        double r893757 = r893755 + r893756;
        return r893757;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.2

    \[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. Taylor expanded around 0 0.1

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

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

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

Reproduce

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