Average Error: 15.2 → 0.0
Time: 8.9s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)}\]
\frac{x}{x \cdot x + 1}
\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)}
double f(double x) {
        double r900097 = x;
        double r900098 = r900097 * r900097;
        double r900099 = 1.0;
        double r900100 = r900098 + r900099;
        double r900101 = r900097 / r900100;
        return r900101;
}

double f(double x) {
        double r900102 = 1.0;
        double r900103 = x;
        double r900104 = hypot(r900102, r900103);
        double r900105 = r900102 / r900104;
        double r900106 = r900103 / r900104;
        double r900107 = r900105 * r900106;
        return r900107;
}

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.0
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Initial program 15.2

    \[\frac{x}{x \cdot x + 1}\]
  2. Simplified15.2

    \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(x, x, 1\right)}}\]
  3. Using strategy rm
  4. Applied clear-num15.2

    \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(x, x, 1\right)}{x}}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity15.2

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{1 \cdot x}}}\]
  7. Applied add-sqr-sqrt15.2

    \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(x, x, 1\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, 1\right)}}}{1 \cdot x}}\]
  8. Applied times-frac15.2

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{1} \cdot \frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{x}}}\]
  9. Applied add-cube-cbrt15.2

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{1} \cdot \frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{x}}\]
  10. Applied times-frac15.2

    \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{x}}}\]
  11. Simplified15.2

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, x\right)}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}{x}}\]
  12. Simplified0.0

    \[\leadsto \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \color{blue}{\frac{x}{\mathsf{hypot}\left(1, x\right)}}\]
  13. Final simplification0.0

    \[\leadsto \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)}\]

Reproduce

herbie shell --seed 2019155 +o rules:numerics
(FPCore (x)
  :name "x / (x^2 + 1)"

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

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