Average Error: 0.1 → 0.1
Time: 18.6s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(x \cdot 9 - 12\right) \cdot x + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(x \cdot 9 - 12\right) \cdot x + 3
double f(double x) {
        double r33535389 = 3.0;
        double r33535390 = x;
        double r33535391 = r33535390 * r33535389;
        double r33535392 = r33535391 * r33535390;
        double r33535393 = 4.0;
        double r33535394 = r33535390 * r33535393;
        double r33535395 = r33535392 - r33535394;
        double r33535396 = 1.0;
        double r33535397 = r33535395 + r33535396;
        double r33535398 = r33535389 * r33535397;
        return r33535398;
}

double f(double x) {
        double r33535399 = x;
        double r33535400 = 9.0;
        double r33535401 = r33535399 * r33535400;
        double r33535402 = 12.0;
        double r33535403 = r33535401 - r33535402;
        double r33535404 = r33535403 * r33535399;
        double r33535405 = 3.0;
        double r33535406 = r33535404 + r33535405;
        return r33535406;
}

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

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

Reproduce

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