Average Error: 0.1 → 0.1
Time: 1.8s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(\left(x \cdot 9\right) \cdot x + 3\right) - 12 \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(\left(x \cdot 9\right) \cdot x + 3\right) - 12 \cdot x
double f(double x) {
        double r709233 = 3.0;
        double r709234 = x;
        double r709235 = r709234 * r709233;
        double r709236 = r709235 * r709234;
        double r709237 = 4.0;
        double r709238 = r709234 * r709237;
        double r709239 = r709236 - r709238;
        double r709240 = 1.0;
        double r709241 = r709239 + r709240;
        double r709242 = r709233 * r709241;
        return r709242;
}

double f(double x) {
        double r709243 = x;
        double r709244 = 9.0;
        double r709245 = r709243 * r709244;
        double r709246 = r709245 * r709243;
        double r709247 = 3.0;
        double r709248 = r709246 + r709247;
        double r709249 = 12.0;
        double r709250 = r709249 * r709243;
        double r709251 = r709248 - r709250;
        return r709251;
}

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. Using strategy rm
  4. Applied unpow20.1

    \[\leadsto \left(9 \cdot \color{blue}{\left(x \cdot x\right)} + 3\right) - 12 \cdot x\]
  5. Applied associate-*r*0.1

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

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

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

Reproduce

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