Average Error: 0.1 → 0.1
Time: 3.4s
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 r403145 = 3.0;
        double r403146 = x;
        double r403147 = r403146 * r403145;
        double r403148 = r403147 * r403146;
        double r403149 = 4.0;
        double r403150 = r403146 * r403149;
        double r403151 = r403148 - r403150;
        double r403152 = 1.0;
        double r403153 = r403151 + r403152;
        double r403154 = r403145 * r403153;
        return r403154;
}

double f(double x) {
        double r403155 = x;
        double r403156 = 9.0;
        double r403157 = r403155 * r403156;
        double r403158 = 12.0;
        double r403159 = r403157 - r403158;
        double r403160 = r403155 * r403159;
        double r403161 = 3.0;
        double r403162 = r403160 + r403161;
        return r403162;
}

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

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

Reproduce

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