Average Error: 0.2 → 0.1
Time: 14.2s
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) + 1 \cdot 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) + 1 \cdot 3
double f(double x) {
        double r36504653 = 3.0;
        double r36504654 = x;
        double r36504655 = r36504654 * r36504653;
        double r36504656 = r36504655 * r36504654;
        double r36504657 = 4.0;
        double r36504658 = r36504654 * r36504657;
        double r36504659 = r36504656 - r36504658;
        double r36504660 = 1.0;
        double r36504661 = r36504659 + r36504660;
        double r36504662 = r36504653 * r36504661;
        return r36504662;
}

double f(double x) {
        double r36504663 = x;
        double r36504664 = 9.0;
        double r36504665 = r36504663 * r36504664;
        double r36504666 = 12.0;
        double r36504667 = r36504665 - r36504666;
        double r36504668 = r36504663 * r36504667;
        double r36504669 = 1.0;
        double r36504670 = 3.0;
        double r36504671 = r36504669 * r36504670;
        double r36504672 = r36504668 + r36504671;
        return r36504672;
}

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. Simplified0.2

    \[\leadsto \color{blue}{1 \cdot 3 + \left(3 \cdot x - 4\right) \cdot \left(3 \cdot x\right)}\]
  3. Taylor expanded around 0 0.1

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

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

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

Reproduce

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