Average Error: 0.2 → 0.1
Time: 10.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(x \cdot x\right) \cdot 9 + \left(3 - x \cdot 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(x \cdot x\right) \cdot 9 + \left(3 - x \cdot 12\right)
double f(double x) {
        double r564499 = 3.0;
        double r564500 = x;
        double r564501 = r564500 * r564499;
        double r564502 = r564501 * r564500;
        double r564503 = 4.0;
        double r564504 = r564500 * r564503;
        double r564505 = r564502 - r564504;
        double r564506 = 1.0;
        double r564507 = r564505 + r564506;
        double r564508 = r564499 * r564507;
        return r564508;
}

double f(double x) {
        double r564509 = x;
        double r564510 = r564509 * r564509;
        double r564511 = 9.0;
        double r564512 = r564510 * r564511;
        double r564513 = 3.0;
        double r564514 = 12.0;
        double r564515 = r564509 * r564514;
        double r564516 = r564513 - r564515;
        double r564517 = r564512 + r564516;
        return r564517;
}

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

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

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

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

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

Reproduce

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