Average Error: 0.1 → 0.1
Time: 14.0s
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 r453186 = 3.0;
        double r453187 = x;
        double r453188 = r453187 * r453186;
        double r453189 = r453188 * r453187;
        double r453190 = 4.0;
        double r453191 = r453187 * r453190;
        double r453192 = r453189 - r453191;
        double r453193 = 1.0;
        double r453194 = r453192 + r453193;
        double r453195 = r453186 * r453194;
        return r453195;
}

double f(double x) {
        double r453196 = 3.0;
        double r453197 = x;
        double r453198 = 9.0;
        double r453199 = r453197 * r453198;
        double r453200 = 12.0;
        double r453201 = r453199 - r453200;
        double r453202 = r453197 * r453201;
        double r453203 = r453196 + r453202;
        return r453203;
}

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