Average Error: 0.1 → 0.1
Time: 6.9s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(9 \cdot x - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(9 \cdot x - 12\right) + 3
double f(double x) {
        double r731450 = 3.0;
        double r731451 = x;
        double r731452 = r731451 * r731450;
        double r731453 = r731452 * r731451;
        double r731454 = 4.0;
        double r731455 = r731451 * r731454;
        double r731456 = r731453 - r731455;
        double r731457 = 1.0;
        double r731458 = r731456 + r731457;
        double r731459 = r731450 * r731458;
        return r731459;
}

double f(double x) {
        double r731460 = x;
        double r731461 = 9.0;
        double r731462 = r731461 * r731460;
        double r731463 = 12.0;
        double r731464 = r731462 - r731463;
        double r731465 = r731460 * r731464;
        double r731466 = 3.0;
        double r731467 = r731465 + r731466;
        return r731467;
}

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. 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}{x \cdot \left(9 \cdot x - 12\right) + 3}\]
  5. Final simplification0.1

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

Reproduce

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