Average Error: 0.2 → 0.1
Time: 3.1s
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 r492544 = 3.0;
        double r492545 = x;
        double r492546 = r492545 * r492544;
        double r492547 = r492546 * r492545;
        double r492548 = 4.0;
        double r492549 = r492545 * r492548;
        double r492550 = r492547 - r492549;
        double r492551 = 1.0;
        double r492552 = r492550 + r492551;
        double r492553 = r492544 * r492552;
        return r492553;
}

double f(double x) {
        double r492554 = x;
        double r492555 = 9.0;
        double r492556 = r492554 * r492555;
        double r492557 = 12.0;
        double r492558 = r492556 - r492557;
        double r492559 = r492554 * r492558;
        double r492560 = 3.0;
        double r492561 = r492559 + r492560;
        return r492561;
}

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}{3 \cdot \left(1 + x \cdot \left(x \cdot 3 - 4\right)\right)}\]
  3. Using strategy rm
  4. Applied pow10.2

    \[\leadsto 3 \cdot \left(1 + x \cdot \color{blue}{{\left(x \cdot 3 - 4\right)}^{1}}\right)\]
  5. Taylor expanded around 0 0.1

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

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

Reproduce

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