Average Error: 0.1 → 0.1
Time: 11.8s
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 r467462 = 3.0;
        double r467463 = x;
        double r467464 = r467463 * r467462;
        double r467465 = r467464 * r467463;
        double r467466 = 4.0;
        double r467467 = r467463 * r467466;
        double r467468 = r467465 - r467467;
        double r467469 = 1.0;
        double r467470 = r467468 + r467469;
        double r467471 = r467462 * r467470;
        return r467471;
}

double f(double x) {
        double r467472 = x;
        double r467473 = 9.0;
        double r467474 = r467472 * r467473;
        double r467475 = 12.0;
        double r467476 = r467474 - r467475;
        double r467477 = r467472 * r467476;
        double r467478 = 3.0;
        double r467479 = r467477 + r467478;
        return r467479;
}

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. Final simplification0.1

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

Reproduce

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