Average Error: 15.2 → 0.1
Time: 2.1s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\frac{1}{x + 1 \cdot \frac{1}{x}}\]
\frac{x}{x \cdot x + 1}
\frac{1}{x + 1 \cdot \frac{1}{x}}
double f(double x) {
        double r55168 = x;
        double r55169 = r55168 * r55168;
        double r55170 = 1.0;
        double r55171 = r55169 + r55170;
        double r55172 = r55168 / r55171;
        return r55172;
}

double f(double x) {
        double r55173 = 1.0;
        double r55174 = x;
        double r55175 = 1.0;
        double r55176 = r55173 / r55174;
        double r55177 = r55175 * r55176;
        double r55178 = r55174 + r55177;
        double r55179 = r55173 / r55178;
        return r55179;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 15.2

    \[\frac{x}{x \cdot x + 1}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt15.2

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

    \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity15.1

    \[\leadsto \frac{\frac{x}{\color{blue}{1 \cdot \sqrt{x \cdot x + 1}}}}{\sqrt{x \cdot x + 1}}\]
  7. Applied *-un-lft-identity15.1

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot x}}{1 \cdot \sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}\]
  8. Applied times-frac15.1

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

    \[\leadsto \color{blue}{\frac{\frac{1}{1}}{\frac{\sqrt{x \cdot x + 1}}{\frac{x}{\sqrt{x \cdot x + 1}}}}}\]
  10. Simplified15.2

    \[\leadsto \frac{\frac{1}{1}}{\color{blue}{\frac{x \cdot x + 1}{x}}}\]
  11. Taylor expanded around 0 0.1

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

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

Reproduce

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

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

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