Average Error: 0.2 → 0.1
Time: 12.5s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left({x}^{2} \cdot 9 + \left(-12 \cdot x\right)\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left({x}^{2} \cdot 9 + \left(-12 \cdot x\right)\right) + 3
double f(double x) {
        double r690253 = 3.0;
        double r690254 = x;
        double r690255 = r690254 * r690253;
        double r690256 = r690255 * r690254;
        double r690257 = 4.0;
        double r690258 = r690254 * r690257;
        double r690259 = r690256 - r690258;
        double r690260 = 1.0;
        double r690261 = r690259 + r690260;
        double r690262 = r690253 * r690261;
        return r690262;
}

double f(double x) {
        double r690263 = x;
        double r690264 = 2.0;
        double r690265 = pow(r690263, r690264);
        double r690266 = 9.0;
        double r690267 = r690265 * r690266;
        double r690268 = 12.0;
        double r690269 = r690268 * r690263;
        double r690270 = -r690269;
        double r690271 = r690267 + r690270;
        double r690272 = 3.0;
        double r690273 = r690271 + r690272;
        return r690273;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[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(9 \cdot x - 12\right) + 3}\]
  4. Using strategy rm
  5. Applied sub-neg0.1

    \[\leadsto x \cdot \color{blue}{\left(9 \cdot x + \left(-12\right)\right)} + 3\]
  6. Applied distribute-lft-in0.1

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

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

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

    \[\leadsto \left({x}^{2} \cdot 9 + \left(-12 \cdot x\right)\right) + 3\]

Reproduce

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