Average Error: 0.1 → 0.1
Time: 12.5s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + x \cdot \left(x \cdot 9 - 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + x \cdot \left(x \cdot 9 - 12\right)
double f(double x) {
        double r915124 = 3.0;
        double r915125 = x;
        double r915126 = r915125 * r915124;
        double r915127 = r915126 * r915125;
        double r915128 = 4.0;
        double r915129 = r915125 * r915128;
        double r915130 = r915127 - r915129;
        double r915131 = 1.0;
        double r915132 = r915130 + r915131;
        double r915133 = r915124 * r915132;
        return r915133;
}

double f(double x) {
        double r915134 = 3.0;
        double r915135 = x;
        double r915136 = 9.0;
        double r915137 = r915135 * r915136;
        double r915138 = 12.0;
        double r915139 = r915137 - r915138;
        double r915140 = r915135 * r915139;
        double r915141 = r915134 + r915140;
        return r915141;
}

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

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

Reproduce

herbie shell --seed 2019350 +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)))