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

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

\end{array}
double f(double x) {
        double r55113 = x;
        double r55114 = r55113 * r55113;
        double r55115 = 1.0;
        double r55116 = r55114 + r55115;
        double r55117 = r55113 / r55116;
        return r55117;
}

double f(double x) {
        double r55118 = x;
        double r55119 = -1289.3783119059435;
        bool r55120 = r55118 <= r55119;
        double r55121 = 1795596.1856781375;
        bool r55122 = r55118 <= r55121;
        double r55123 = !r55122;
        bool r55124 = r55120 || r55123;
        double r55125 = 1.0;
        double r55126 = r55125 / r55118;
        double r55127 = 1.0;
        double r55128 = 5.0;
        double r55129 = pow(r55118, r55128);
        double r55130 = r55127 / r55129;
        double r55131 = r55126 + r55130;
        double r55132 = 3.0;
        double r55133 = pow(r55118, r55132);
        double r55134 = r55127 / r55133;
        double r55135 = r55131 - r55134;
        double r55136 = 4.0;
        double r55137 = pow(r55118, r55136);
        double r55138 = r55127 * r55127;
        double r55139 = r55137 - r55138;
        double r55140 = r55118 / r55139;
        double r55141 = r55118 * r55118;
        double r55142 = r55141 - r55127;
        double r55143 = r55140 * r55142;
        double r55144 = r55124 ? r55135 : r55143;
        return r55144;
}

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 < -1289.3783119059435 or 1795596.1856781375 < x

    1. Initial program 31.2

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

      \[\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.9

      \[\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.9

      \[\leadsto \color{blue}{\frac{x}{{x}^{4} - 1 \cdot 1}} \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}}}\]
    7. Simplified0.0

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

    if -1289.3783119059435 < x < 1795596.1856781375

    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}{{x}^{4} - 1 \cdot 1}} \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 -1289.378311905943519377615302801132202148 \lor \neg \left(x \le 1795596.18567813746631145477294921875\right):\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{{x}^{4} - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)\\ \end{array}\]

Reproduce

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

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

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