Average Error: 15.5 → 0.0
Time: 1.8s
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 r61908 = x;
        double r61909 = r61908 * r61908;
        double r61910 = 1.0;
        double r61911 = r61909 + r61910;
        double r61912 = r61908 / r61911;
        return r61912;
}

double f(double x) {
        double r61913 = x;
        double r61914 = -542649.7982661554;
        bool r61915 = r61913 <= r61914;
        double r61916 = 904431.5607004879;
        bool r61917 = r61913 <= r61916;
        double r61918 = !r61917;
        bool r61919 = r61915 || r61918;
        double r61920 = 1.0;
        double r61921 = 1.0;
        double r61922 = 5.0;
        double r61923 = pow(r61913, r61922);
        double r61924 = r61921 / r61923;
        double r61925 = r61920 * r61924;
        double r61926 = r61921 / r61913;
        double r61927 = r61925 + r61926;
        double r61928 = 3.0;
        double r61929 = pow(r61913, r61928);
        double r61930 = r61921 / r61929;
        double r61931 = r61920 * r61930;
        double r61932 = r61927 - r61931;
        double r61933 = r61920 * r61920;
        double r61934 = -r61933;
        double r61935 = 4.0;
        double r61936 = pow(r61913, r61935);
        double r61937 = r61934 + r61936;
        double r61938 = r61913 / r61937;
        double r61939 = r61913 * r61913;
        double r61940 = r61939 - r61920;
        double r61941 = r61938 * r61940;
        double r61942 = r61919 ? r61932 : r61941;
        return r61942;
}

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)))