Average Error: 0.1 → 0.1
Time: 10.7s
Precision: 64
\[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
\[\left(3.0 + \left(9.0 \cdot x\right) \cdot x\right) - 12.0 \cdot x\]
3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)
\left(3.0 + \left(9.0 \cdot x\right) \cdot x\right) - 12.0 \cdot x
double f(double x) {
        double r36712906 = 3.0;
        double r36712907 = x;
        double r36712908 = r36712907 * r36712906;
        double r36712909 = r36712908 * r36712907;
        double r36712910 = 4.0;
        double r36712911 = r36712907 * r36712910;
        double r36712912 = r36712909 - r36712911;
        double r36712913 = 1.0;
        double r36712914 = r36712912 + r36712913;
        double r36712915 = r36712906 * r36712914;
        return r36712915;
}

double f(double x) {
        double r36712916 = 3.0;
        double r36712917 = 9.0;
        double r36712918 = x;
        double r36712919 = r36712917 * r36712918;
        double r36712920 = r36712919 * r36712918;
        double r36712921 = r36712916 + r36712920;
        double r36712922 = 12.0;
        double r36712923 = r36712922 * r36712918;
        double r36712924 = r36712921 - r36712923;
        return r36712924;
}

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.0 + \left(\left(9.0 \cdot x\right) \cdot x - 12.0 \cdot x\right)\]

Derivation

  1. Initial program 0.1

    \[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
  2. Taylor expanded around 0 0.1

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

    \[\leadsto \color{blue}{\left(3.0 + x \cdot \left(x \cdot 9.0\right)\right) - x \cdot 12.0}\]
  4. Final simplification0.1

    \[\leadsto \left(3.0 + \left(9.0 \cdot x\right) \cdot x\right) - 12.0 \cdot x\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))