Average Error: 15.5 → 0.0
Time: 1.9s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -542649.79826615541242063045501708984375 \lor \neg \left(x \le 904431.560700487927533686161041259765625\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 -542649.79826615541242063045501708984375 \lor \neg \left(x \le 904431.560700487927533686161041259765625\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 r65036 = x;
        double r65037 = r65036 * r65036;
        double r65038 = 1.0;
        double r65039 = r65037 + r65038;
        double r65040 = r65036 / r65039;
        return r65040;
}

double f(double x) {
        double r65041 = x;
        double r65042 = -542649.7982661554;
        bool r65043 = r65041 <= r65042;
        double r65044 = 904431.5607004879;
        bool r65045 = r65041 <= r65044;
        double r65046 = !r65045;
        bool r65047 = r65043 || r65046;
        double r65048 = 1.0;
        double r65049 = 1.0;
        double r65050 = 5.0;
        double r65051 = pow(r65041, r65050);
        double r65052 = r65049 / r65051;
        double r65053 = r65048 * r65052;
        double r65054 = r65049 / r65041;
        double r65055 = r65053 + r65054;
        double r65056 = 3.0;
        double r65057 = pow(r65041, r65056);
        double r65058 = r65049 / r65057;
        double r65059 = r65048 * r65058;
        double r65060 = r65055 - r65059;
        double r65061 = r65048 * r65048;
        double r65062 = -r65061;
        double r65063 = 4.0;
        double r65064 = pow(r65041, r65063);
        double r65065 = r65062 + r65064;
        double r65066 = r65041 / r65065;
        double r65067 = r65041 * r65041;
        double r65068 = r65067 - r65048;
        double r65069 = r65066 * r65068;
        double r65070 = r65047 ? r65060 : r65069;
        return r65070;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -542649.7982661554 or 904431.5607004879 < x

    1. Initial program 31.3

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

      \[\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}{\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 -542649.7982661554 < x < 904431.5607004879

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

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

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