Average Error: 14.7 → 0.1
Time: 43.3s
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 r6277556 = x;
        double r6277557 = r6277556 * r6277556;
        double r6277558 = 1.0;
        double r6277559 = r6277557 + r6277558;
        double r6277560 = r6277556 / r6277559;
        return r6277560;
}

double f(double x) {
        double r6277561 = 1.0;
        double r6277562 = x;
        double r6277563 = r6277561 / r6277562;
        double r6277564 = r6277562 + r6277563;
        double r6277565 = r6277561 / r6277564;
        return r6277565;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 14.7

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot x + 1}{x}}}\]
  5. Taylor expanded around 0 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 2019124 
(FPCore (x)
  :name "x / (x^2 + 1)"

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

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