Average Error: 0.1 → 0.1
Time: 12.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + \left(9 \cdot x - 12\right) \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + \left(9 \cdot x - 12\right) \cdot x
double f(double x) {
        double r463916 = 3.0;
        double r463917 = x;
        double r463918 = r463917 * r463916;
        double r463919 = r463918 * r463917;
        double r463920 = 4.0;
        double r463921 = r463917 * r463920;
        double r463922 = r463919 - r463921;
        double r463923 = 1.0;
        double r463924 = r463922 + r463923;
        double r463925 = r463916 * r463924;
        return r463925;
}

double f(double x) {
        double r463926 = 3.0;
        double r463927 = 9.0;
        double r463928 = x;
        double r463929 = r463927 * r463928;
        double r463930 = 12.0;
        double r463931 = r463929 - r463930;
        double r463932 = r463931 * r463928;
        double r463933 = r463926 + r463932;
        return r463933;
}

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. Taylor expanded around 0 0.1

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

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

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

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

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

Reproduce

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