Average Error: 0.1 → 0.1
Time: 14.3s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(x \cdot 9 - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(x \cdot 9 - 12\right) + 3
double f(double x) {
        double r442714 = 3.0;
        double r442715 = x;
        double r442716 = r442715 * r442714;
        double r442717 = r442716 * r442715;
        double r442718 = 4.0;
        double r442719 = r442715 * r442718;
        double r442720 = r442717 - r442719;
        double r442721 = 1.0;
        double r442722 = r442720 + r442721;
        double r442723 = r442714 * r442722;
        return r442723;
}

double f(double x) {
        double r442724 = x;
        double r442725 = 9.0;
        double r442726 = r442724 * r442725;
        double r442727 = 12.0;
        double r442728 = r442726 - r442727;
        double r442729 = r442724 * r442728;
        double r442730 = 3.0;
        double r442731 = r442729 + r442730;
        return r442731;
}

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

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

Reproduce

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