Average Error: 0.1 → 0.1
Time: 10.6s
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 r733688 = 3.0;
        double r733689 = x;
        double r733690 = r733689 * r733688;
        double r733691 = r733690 * r733689;
        double r733692 = 4.0;
        double r733693 = r733689 * r733692;
        double r733694 = r733691 - r733693;
        double r733695 = 1.0;
        double r733696 = r733694 + r733695;
        double r733697 = r733688 * r733696;
        return r733697;
}

double f(double x) {
        double r733698 = x;
        double r733699 = 9.0;
        double r733700 = r733698 * r733699;
        double r733701 = 12.0;
        double r733702 = r733700 - r733701;
        double r733703 = r733698 * r733702;
        double r733704 = 3.0;
        double r733705 = r733703 + r733704;
        return r733705;
}

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 \mathsf{fma}\left(x, x \cdot 3 - 4, 1\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 2020047 +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)))