Average Error: 0.2 → 0.1
Time: 10.4s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(x \cdot \left(3 \cdot x - 4\right)\right) \cdot 3 + 3 \cdot 1\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(x \cdot \left(3 \cdot x - 4\right)\right) \cdot 3 + 3 \cdot 1
double f(double x) {
        double r813679 = 3.0;
        double r813680 = x;
        double r813681 = r813680 * r813679;
        double r813682 = r813681 * r813680;
        double r813683 = 4.0;
        double r813684 = r813680 * r813683;
        double r813685 = r813682 - r813684;
        double r813686 = 1.0;
        double r813687 = r813685 + r813686;
        double r813688 = r813679 * r813687;
        return r813688;
}

double f(double x) {
        double r813689 = x;
        double r813690 = 3.0;
        double r813691 = r813690 * r813689;
        double r813692 = 4.0;
        double r813693 = r813691 - r813692;
        double r813694 = r813689 * r813693;
        double r813695 = r813694 * r813690;
        double r813696 = 1.0;
        double r813697 = r813690 * r813696;
        double r813698 = r813695 + r813697;
        return r813698;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
  2. Using strategy rm
  3. Applied distribute-lft-in0.1

    \[\leadsto \color{blue}{3 \cdot \left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 3 \cdot 1}\]
  4. Simplified0.1

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

    \[\leadsto \left(x \cdot \left(3 \cdot x - 4\right)\right) \cdot 3 + 3 \cdot 1\]

Reproduce

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