Average Error: 0.1 → 0.1
Time: 12.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(\left(x \cdot x\right) \cdot 9 + 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 x\right) \cdot 9 + 3\right) - 12 \cdot x
double f(double x) {
        double r47897326 = 3.0;
        double r47897327 = x;
        double r47897328 = r47897327 * r47897326;
        double r47897329 = r47897328 * r47897327;
        double r47897330 = 4.0;
        double r47897331 = r47897327 * r47897330;
        double r47897332 = r47897329 - r47897331;
        double r47897333 = 1.0;
        double r47897334 = r47897332 + r47897333;
        double r47897335 = r47897326 * r47897334;
        return r47897335;
}

double f(double x) {
        double r47897336 = x;
        double r47897337 = r47897336 * r47897336;
        double r47897338 = 9.0;
        double r47897339 = r47897337 * r47897338;
        double r47897340 = 3.0;
        double r47897341 = r47897339 + r47897340;
        double r47897342 = 12.0;
        double r47897343 = r47897342 * r47897336;
        double r47897344 = r47897341 - r47897343;
        return r47897344;
}

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. Simplified0.1

    \[\leadsto \color{blue}{3 \cdot \left(1 + x \cdot \left(x \cdot 3 - 4\right)\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.3

    \[\leadsto 3 \cdot \color{blue}{\left(\sqrt{1 + x \cdot \left(x \cdot 3 - 4\right)} \cdot \sqrt{1 + x \cdot \left(x \cdot 3 - 4\right)}\right)}\]
  5. Applied associate-*r*0.3

    \[\leadsto \color{blue}{\left(3 \cdot \sqrt{1 + x \cdot \left(x \cdot 3 - 4\right)}\right) \cdot \sqrt{1 + x \cdot \left(x \cdot 3 - 4\right)}}\]
  6. Taylor expanded around 0 0.1

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

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))