Average Error: 15.1 → 0.0
Time: 49.3s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3559032781469798 \cdot 10^{+154}:\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\ \mathbf{elif}\;x \le 423.7918602723902:\\ \;\;\;\;\frac{\frac{x}{\sqrt{1 + x \cdot x}}}{\sqrt{1 + x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -1.3559032781469798 \cdot 10^{+154}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\

\mathbf{elif}\;x \le 423.7918602723902:\\
\;\;\;\;\frac{\frac{x}{\sqrt{1 + x \cdot x}}}{\sqrt{1 + x \cdot x}}\\

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

\end{array}
double f(double x) {
        double r5543879 = x;
        double r5543880 = r5543879 * r5543879;
        double r5543881 = 1.0;
        double r5543882 = r5543880 + r5543881;
        double r5543883 = r5543879 / r5543882;
        return r5543883;
}

double f(double x) {
        double r5543884 = x;
        double r5543885 = -1.3559032781469798e+154;
        bool r5543886 = r5543884 <= r5543885;
        double r5543887 = 1.0;
        double r5543888 = 5.0;
        double r5543889 = pow(r5543884, r5543888);
        double r5543890 = r5543887 / r5543889;
        double r5543891 = r5543887 / r5543884;
        double r5543892 = r5543890 + r5543891;
        double r5543893 = r5543884 * r5543884;
        double r5543894 = r5543893 * r5543884;
        double r5543895 = r5543887 / r5543894;
        double r5543896 = r5543892 - r5543895;
        double r5543897 = 423.7918602723902;
        bool r5543898 = r5543884 <= r5543897;
        double r5543899 = r5543887 + r5543893;
        double r5543900 = sqrt(r5543899);
        double r5543901 = r5543884 / r5543900;
        double r5543902 = r5543901 / r5543900;
        double r5543903 = r5543898 ? r5543902 : r5543896;
        double r5543904 = r5543886 ? r5543896 : r5543903;
        return r5543904;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < -1.3559032781469798e+154 or 423.7918602723902 < x

    1. Initial program 39.9

      \[\frac{x}{x \cdot x + 1}\]
    2. Taylor expanded around -inf 0.0

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

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

    if -1.3559032781469798e+154 < x < 423.7918602723902

    1. Initial program 0.1

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.3559032781469798 \cdot 10^{+154}:\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\ \mathbf{elif}\;x \le 423.7918602723902:\\ \;\;\;\;\frac{\frac{x}{\sqrt{1 + x \cdot x}}}{\sqrt{1 + x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\ \end{array}\]

Reproduce

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

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

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