Average Error: 14.4 → 0.0
Time: 5.5s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -525.1650773382436909741954877972602844238 \lor \neg \left(x \le 483.7235501018238323922560084611177444458\right):\\ \;\;\;\;\frac{1}{x} + \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right)\\ \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 -525.1650773382436909741954877972602844238 \lor \neg \left(x \le 483.7235501018238323922560084611177444458\right):\\
\;\;\;\;\frac{1}{x} + \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right)\\

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

\end{array}
double f(double x) {
        double r76239 = x;
        double r76240 = r76239 * r76239;
        double r76241 = 1.0;
        double r76242 = r76240 + r76241;
        double r76243 = r76239 / r76242;
        return r76243;
}

double f(double x) {
        double r76244 = x;
        double r76245 = -525.1650773382437;
        bool r76246 = r76244 <= r76245;
        double r76247 = 483.72355010182383;
        bool r76248 = r76244 <= r76247;
        double r76249 = !r76248;
        bool r76250 = r76246 || r76249;
        double r76251 = 1.0;
        double r76252 = r76251 / r76244;
        double r76253 = 1.0;
        double r76254 = 5.0;
        double r76255 = pow(r76244, r76254);
        double r76256 = r76253 / r76255;
        double r76257 = 3.0;
        double r76258 = pow(r76244, r76257);
        double r76259 = r76253 / r76258;
        double r76260 = r76256 - r76259;
        double r76261 = r76252 + r76260;
        double r76262 = 4.0;
        double r76263 = pow(r76244, r76262);
        double r76264 = r76253 * r76253;
        double r76265 = r76263 - r76264;
        double r76266 = r76244 / r76265;
        double r76267 = r76244 * r76244;
        double r76268 = r76267 - r76253;
        double r76269 = r76266 * r76268;
        double r76270 = r76250 ? r76261 : r76269;
        return r76270;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -525.1650773382437 or 483.72355010182383 < x

    1. Initial program 29.6

      \[\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}{\frac{1}{x} + \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right)}\]

    if -525.1650773382437 < x < 483.72355010182383

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

Reproduce

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

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

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