Average Error: 0.1 → 0.1
Time: 8.9s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + \left(\left(x \cdot x\right) \cdot 9 - 12 \cdot x\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + \left(\left(x \cdot x\right) \cdot 9 - 12 \cdot x\right)
double f(double x) {
        double r813123 = 3.0;
        double r813124 = x;
        double r813125 = r813124 * r813123;
        double r813126 = r813125 * r813124;
        double r813127 = 4.0;
        double r813128 = r813124 * r813127;
        double r813129 = r813126 - r813128;
        double r813130 = 1.0;
        double r813131 = r813129 + r813130;
        double r813132 = r813123 * r813131;
        return r813132;
}

double f(double x) {
        double r813133 = 3.0;
        double r813134 = x;
        double r813135 = r813134 * r813134;
        double r813136 = 9.0;
        double r813137 = r813135 * r813136;
        double r813138 = 12.0;
        double r813139 = r813138 * r813134;
        double r813140 = r813137 - r813139;
        double r813141 = r813133 + r813140;
        return r813141;
}

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 + \left(3 \cdot x - 4\right) \cdot x\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 + \left(x \cdot \left(x \cdot 9\right) - 12 \cdot x\right)}\]
  5. Using strategy rm
  6. Applied associate-*r*0.1

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

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

Reproduce

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

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))