Average Error: 15.4 → 0.0
Time: 1.8s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -599.2763266259171 \lor \neg \left(x \le 261301.49671835295\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 -599.2763266259171 \lor \neg \left(x \le 261301.49671835295\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 r84114 = x;
        double r84115 = r84114 * r84114;
        double r84116 = 1.0;
        double r84117 = r84115 + r84116;
        double r84118 = r84114 / r84117;
        return r84118;
}

double f(double x) {
        double r84119 = x;
        double r84120 = -599.2763266259171;
        bool r84121 = r84119 <= r84120;
        double r84122 = 261301.49671835295;
        bool r84123 = r84119 <= r84122;
        double r84124 = !r84123;
        bool r84125 = r84121 || r84124;
        double r84126 = 1.0;
        double r84127 = 1.0;
        double r84128 = 5.0;
        double r84129 = pow(r84119, r84128);
        double r84130 = r84127 / r84129;
        double r84131 = r84126 * r84130;
        double r84132 = r84127 / r84119;
        double r84133 = r84131 + r84132;
        double r84134 = 3.0;
        double r84135 = pow(r84119, r84134);
        double r84136 = r84127 / r84135;
        double r84137 = r84126 * r84136;
        double r84138 = r84133 - r84137;
        double r84139 = r84126 * r84126;
        double r84140 = -r84139;
        double r84141 = 4.0;
        double r84142 = pow(r84119, r84141);
        double r84143 = r84140 + r84142;
        double r84144 = r84119 / r84143;
        double r84145 = r84119 * r84119;
        double r84146 = r84145 - r84126;
        double r84147 = r84144 * r84146;
        double r84148 = r84125 ? r84138 : r84147;
        return r84148;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -599.2763266259171 or 261301.49671835295 < x

    1. Initial program 31.0

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

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

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

      \[\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 -599.2763266259171 < x < 261301.49671835295

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

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

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