Average Error: 14.8 → 0.0
Time: 7.3s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4570954960442.3818359375 \lor \neg \left(x \le 422.3447739140714247696450911462306976318\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \left(x \cdot x - 1\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -4570954960442.3818359375 \lor \neg \left(x \le 422.3447739140714247696450911462306976318\right):\\
\;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \left(x \cdot x - 1\right)\\

\end{array}
double f(double x) {
        double r45767 = x;
        double r45768 = r45767 * r45767;
        double r45769 = 1.0;
        double r45770 = r45768 + r45769;
        double r45771 = r45767 / r45770;
        return r45771;
}

double f(double x) {
        double r45772 = x;
        double r45773 = -4570954960442.382;
        bool r45774 = r45772 <= r45773;
        double r45775 = 422.3447739140714;
        bool r45776 = r45772 <= r45775;
        double r45777 = !r45776;
        bool r45778 = r45774 || r45777;
        double r45779 = 1.0;
        double r45780 = 1.0;
        double r45781 = 5.0;
        double r45782 = pow(r45772, r45781);
        double r45783 = r45780 / r45782;
        double r45784 = r45779 * r45783;
        double r45785 = r45780 / r45772;
        double r45786 = r45784 + r45785;
        double r45787 = 3.0;
        double r45788 = pow(r45772, r45787);
        double r45789 = r45780 / r45788;
        double r45790 = r45779 * r45789;
        double r45791 = r45786 - r45790;
        double r45792 = r45779 * r45779;
        double r45793 = -r45792;
        double r45794 = 4.0;
        double r45795 = pow(r45772, r45794);
        double r45796 = r45793 + r45795;
        double r45797 = r45772 / r45796;
        double r45798 = r45772 * r45772;
        double r45799 = r45798 - r45779;
        double r45800 = r45797 * r45799;
        double r45801 = r45778 ? r45791 : r45800;
        return r45801;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -4570954960442.382 or 422.3447739140714 < x

    1. Initial program 30.2

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+48.1

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/48.1

      \[\leadsto \color{blue}{\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)}\]
    5. Simplified48.1

      \[\leadsto \color{blue}{\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}}} \cdot \left(x \cdot x - 1\right)\]
    6. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}}\]

    if -4570954960442.382 < x < 422.3447739140714

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+0.0

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/0.0

      \[\leadsto \color{blue}{\frac{x}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)}\]
    5. Simplified0.0

      \[\leadsto \color{blue}{\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}}} \cdot \left(x \cdot x - 1\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4570954960442.3818359375 \lor \neg \left(x \le 422.3447739140714247696450911462306976318\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \left(x \cdot x - 1\right)\\ \end{array}\]

Reproduce

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

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

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