Average Error: 0.1 → 0.1
Time: 16.9s
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 r517087 = 3.0;
        double r517088 = x;
        double r517089 = r517088 * r517087;
        double r517090 = r517089 * r517088;
        double r517091 = 4.0;
        double r517092 = r517088 * r517091;
        double r517093 = r517090 - r517092;
        double r517094 = 1.0;
        double r517095 = r517093 + r517094;
        double r517096 = r517087 * r517095;
        return r517096;
}

double f(double x) {
        double r517097 = x;
        double r517098 = 9.0;
        double r517099 = r517098 * r517097;
        double r517100 = 12.0;
        double r517101 = r517099 - r517100;
        double r517102 = r517097 * r517101;
        double r517103 = 3.0;
        double r517104 = r517102 + r517103;
        return r517104;
}

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

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

Reproduce

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