Average Error: 0.1 → 0.1
Time: 14.8s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 + x \cdot \left(x \cdot 9 - 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 + x \cdot \left(x \cdot 9 - 12\right)
double f(double x) {
        double r496039 = 3.0;
        double r496040 = x;
        double r496041 = r496040 * r496039;
        double r496042 = r496041 * r496040;
        double r496043 = 4.0;
        double r496044 = r496040 * r496043;
        double r496045 = r496042 - r496044;
        double r496046 = 1.0;
        double r496047 = r496045 + r496046;
        double r496048 = r496039 * r496047;
        return r496048;
}

double f(double x) {
        double r496049 = 3.0;
        double r496050 = x;
        double r496051 = 9.0;
        double r496052 = r496050 * r496051;
        double r496053 = 12.0;
        double r496054 = r496052 - r496053;
        double r496055 = r496050 * r496054;
        double r496056 = r496049 + r496055;
        return r496056;
}

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

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

Reproduce

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