Average Error: 0.1 → 0.1
Time: 11.3s
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 r500807 = 3.0;
        double r500808 = x;
        double r500809 = r500808 * r500807;
        double r500810 = r500809 * r500808;
        double r500811 = 4.0;
        double r500812 = r500808 * r500811;
        double r500813 = r500810 - r500812;
        double r500814 = 1.0;
        double r500815 = r500813 + r500814;
        double r500816 = r500807 * r500815;
        return r500816;
}

double f(double x) {
        double r500817 = x;
        double r500818 = 9.0;
        double r500819 = r500818 * r500817;
        double r500820 = 12.0;
        double r500821 = r500819 - r500820;
        double r500822 = r500817 * r500821;
        double r500823 = 3.0;
        double r500824 = r500822 + r500823;
        return r500824;
}

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. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  3. Using strategy rm
  4. Applied associate--l+0.1

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

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

Reproduce

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