Average Error: 0.2 → 0.1
Time: 1.2m
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 - \left(12 - 9 \cdot x\right) \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 - \left(12 - 9 \cdot x\right) \cdot x
double f(double x) {
        double r36260401 = 3.0;
        double r36260402 = x;
        double r36260403 = r36260402 * r36260401;
        double r36260404 = r36260403 * r36260402;
        double r36260405 = 4.0;
        double r36260406 = r36260402 * r36260405;
        double r36260407 = r36260404 - r36260406;
        double r36260408 = 1.0;
        double r36260409 = r36260407 + r36260408;
        double r36260410 = r36260401 * r36260409;
        return r36260410;
}

double f(double x) {
        double r36260411 = 3.0;
        double r36260412 = 12.0;
        double r36260413 = 9.0;
        double r36260414 = x;
        double r36260415 = r36260413 * r36260414;
        double r36260416 = r36260412 - r36260415;
        double r36260417 = r36260416 * r36260414;
        double r36260418 = r36260411 - r36260417;
        return r36260418;
}

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.2

    \[\leadsto \color{blue}{\left(x \cdot \left(x \cdot 3 - 4\right) + 1\right) \cdot 3}\]
  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 12 - \left(x \cdot x\right) \cdot 9\right)}\]
  5. Taylor expanded around 0 0.1

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

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

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

Reproduce

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