Average Error: 0.1 → 0.1
Time: 20.8s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + \left(\left(9 \cdot x\right) \cdot x + x \cdot \left(-12\right)\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + \left(\left(9 \cdot x\right) \cdot x + x \cdot \left(-12\right)\right)
double f(double x) {
        double r433243 = 3.0;
        double r433244 = x;
        double r433245 = r433244 * r433243;
        double r433246 = r433245 * r433244;
        double r433247 = 4.0;
        double r433248 = r433244 * r433247;
        double r433249 = r433246 - r433248;
        double r433250 = 1.0;
        double r433251 = r433249 + r433250;
        double r433252 = r433243 * r433251;
        return r433252;
}

double f(double x) {
        double r433253 = 3.0;
        double r433254 = 9.0;
        double r433255 = x;
        double r433256 = r433254 * r433255;
        double r433257 = r433256 * r433255;
        double r433258 = 12.0;
        double r433259 = -r433258;
        double r433260 = r433255 * r433259;
        double r433261 = r433257 + r433260;
        double r433262 = r433253 + r433261;
        return r433262;
}

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

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

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

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

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

Reproduce

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