Average Error: 15.3 → 0.0
Time: 6.9s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2684357142190736644505600 \lor \neg \left(x \le 484.1711366885760980949271470308303833008\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 -2684357142190736644505600 \lor \neg \left(x \le 484.1711366885760980949271470308303833008\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 r42715 = x;
        double r42716 = r42715 * r42715;
        double r42717 = 1.0;
        double r42718 = r42716 + r42717;
        double r42719 = r42715 / r42718;
        return r42719;
}

double f(double x) {
        double r42720 = x;
        double r42721 = -2.6843571421907366e+24;
        bool r42722 = r42720 <= r42721;
        double r42723 = 484.1711366885761;
        bool r42724 = r42720 <= r42723;
        double r42725 = !r42724;
        bool r42726 = r42722 || r42725;
        double r42727 = 1.0;
        double r42728 = 1.0;
        double r42729 = 5.0;
        double r42730 = pow(r42720, r42729);
        double r42731 = r42728 / r42730;
        double r42732 = r42727 * r42731;
        double r42733 = r42728 / r42720;
        double r42734 = r42732 + r42733;
        double r42735 = 3.0;
        double r42736 = pow(r42720, r42735);
        double r42737 = r42728 / r42736;
        double r42738 = r42727 * r42737;
        double r42739 = r42734 - r42738;
        double r42740 = r42727 * r42727;
        double r42741 = -r42740;
        double r42742 = 4.0;
        double r42743 = pow(r42720, r42742);
        double r42744 = r42741 + r42743;
        double r42745 = r42720 / r42744;
        double r42746 = r42720 * r42720;
        double r42747 = r42746 - r42727;
        double r42748 = r42745 * r42747;
        double r42749 = r42726 ? r42739 : r42748;
        return r42749;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -2.6843571421907366e+24 or 484.1711366885761 < x

    1. Initial program 32.1

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+50.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/50.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. Simplified50.0

      \[\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 -2.6843571421907366e+24 < x < 484.1711366885761

    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 -2684357142190736644505600 \lor \neg \left(x \le 484.1711366885760980949271470308303833008\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 2019294 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

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

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