Average Error: 15.1 → 0.1
Time: 19.6s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\frac{1}{x + \frac{1}{x}}\]
\frac{x}{x \cdot x + 1}
\frac{1}{x + \frac{1}{x}}
double f(double x) {
        double r1072646 = x;
        double r1072647 = r1072646 * r1072646;
        double r1072648 = 1.0;
        double r1072649 = r1072647 + r1072648;
        double r1072650 = r1072646 / r1072649;
        return r1072650;
}

double f(double x) {
        double r1072651 = 1.0;
        double r1072652 = x;
        double r1072653 = r1072651 / r1072652;
        double r1072654 = r1072652 + r1072653;
        double r1072655 = r1072651 / r1072654;
        return r1072655;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.1
Target0.1
Herbie0.1
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Initial program 15.1

    \[\frac{x}{x \cdot x + 1}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity15.1

    \[\leadsto \frac{\color{blue}{1 \cdot x}}{x \cdot x + 1}\]
  4. Applied associate-/l*15.1

    \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot x + 1}{x}}}\]
  5. Taylor expanded around -inf 0.1

    \[\leadsto \frac{1}{\color{blue}{x + \frac{1}{x}}}\]
  6. Final simplification0.1

    \[\leadsto \frac{1}{x + \frac{1}{x}}\]

Reproduce

herbie shell --seed 2019144 
(FPCore (x)
  :name "x / (x^2 + 1)"

  :herbie-target
  (/ 1 (+ x (/ 1 x)))

  (/ x (+ (* x x) 1)))