Average Error: 0.2 → 0.1
Time: 15.4s
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 r424534 = 3.0;
        double r424535 = x;
        double r424536 = r424535 * r424534;
        double r424537 = r424536 * r424535;
        double r424538 = 4.0;
        double r424539 = r424535 * r424538;
        double r424540 = r424537 - r424539;
        double r424541 = 1.0;
        double r424542 = r424540 + r424541;
        double r424543 = r424534 * r424542;
        return r424543;
}

double f(double x) {
        double r424544 = x;
        double r424545 = 9.0;
        double r424546 = r424544 * r424545;
        double r424547 = 12.0;
        double r424548 = r424546 - r424547;
        double r424549 = r424544 * r424548;
        double r424550 = 3.0;
        double r424551 = r424549 + r424550;
        return r424551;
}

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.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}{x \cdot \left(x \cdot 9 - 12\right) + 3}\]
  5. Final simplification0.1

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

Reproduce

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