Average Error: 15.4 → 0.0
Time: 12.5s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -64270072.71622894704341888427734375 \lor \neg \left(x \le 454.9257941514320577880425844341516494751\right):\\ \;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{{x}^{6} + {1}^{3}} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -64270072.71622894704341888427734375 \lor \neg \left(x \le 454.9257941514320577880425844341516494751\right):\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\

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

\end{array}
double f(double x) {
        double r71192 = x;
        double r71193 = r71192 * r71192;
        double r71194 = 1.0;
        double r71195 = r71193 + r71194;
        double r71196 = r71192 / r71195;
        return r71196;
}

double f(double x) {
        double r71197 = x;
        double r71198 = -64270072.71622895;
        bool r71199 = r71197 <= r71198;
        double r71200 = 454.92579415143206;
        bool r71201 = r71197 <= r71200;
        double r71202 = !r71201;
        bool r71203 = r71199 || r71202;
        double r71204 = 1.0;
        double r71205 = 5.0;
        double r71206 = pow(r71197, r71205);
        double r71207 = r71204 / r71206;
        double r71208 = 1.0;
        double r71209 = r71208 / r71197;
        double r71210 = r71207 + r71209;
        double r71211 = 3.0;
        double r71212 = pow(r71197, r71211);
        double r71213 = r71204 / r71212;
        double r71214 = r71210 - r71213;
        double r71215 = 6.0;
        double r71216 = pow(r71197, r71215);
        double r71217 = pow(r71204, r71211);
        double r71218 = r71216 + r71217;
        double r71219 = r71197 / r71218;
        double r71220 = r71197 * r71197;
        double r71221 = r71220 * r71220;
        double r71222 = r71204 * r71204;
        double r71223 = r71220 * r71204;
        double r71224 = r71222 - r71223;
        double r71225 = r71221 + r71224;
        double r71226 = r71219 * r71225;
        double r71227 = r71203 ? r71214 : r71226;
        return r71227;
}

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 < -64270072.71622895 or 454.92579415143206 < x

    1. Initial program 31.2

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

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

    if -64270072.71622895 < x < 454.92579415143206

    1. Initial program 0.0

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

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

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

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

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

Reproduce

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

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

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