Average Error: 0.1 → 0.1
Time: 13.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(9 \cdot x - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(9 \cdot x - 12\right) + 3
double f(double x) {
        double r755539 = 3.0;
        double r755540 = x;
        double r755541 = r755540 * r755539;
        double r755542 = r755541 * r755540;
        double r755543 = 4.0;
        double r755544 = r755540 * r755543;
        double r755545 = r755542 - r755544;
        double r755546 = 1.0;
        double r755547 = r755545 + r755546;
        double r755548 = r755539 * r755547;
        return r755548;
}

double f(double x) {
        double r755549 = x;
        double r755550 = 9.0;
        double r755551 = r755550 * r755549;
        double r755552 = 12.0;
        double r755553 = r755551 - r755552;
        double r755554 = r755549 * r755553;
        double r755555 = 3.0;
        double r755556 = r755554 + r755555;
        return r755556;
}

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

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

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

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

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(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)))