Average Error: 15.1 → 0.0
Time: 10.2s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -256116492245931.84375:\\ \;\;\;\;\left(\frac{1}{x} - \frac{1}{\left(x \cdot x\right) \cdot x}\right) + \frac{1}{{x}^{5}}\\ \mathbf{elif}\;x \le 1075528.26263211597688496112823486328125:\\ \;\;\;\;\frac{x}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + 1 \cdot \left(1 \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - 1 \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} - \frac{1}{\left(x \cdot x\right) \cdot x}\right) + \frac{1}{{x}^{5}}\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -256116492245931.84375:\\
\;\;\;\;\left(\frac{1}{x} - \frac{1}{\left(x \cdot x\right) \cdot x}\right) + \frac{1}{{x}^{5}}\\

\mathbf{elif}\;x \le 1075528.26263211597688496112823486328125:\\
\;\;\;\;\frac{x}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + 1 \cdot \left(1 \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - 1 \cdot \left(x \cdot x\right)\right)\right)\\

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

\end{array}
double f(double x) {
        double r3415835 = x;
        double r3415836 = r3415835 * r3415835;
        double r3415837 = 1.0;
        double r3415838 = r3415836 + r3415837;
        double r3415839 = r3415835 / r3415838;
        return r3415839;
}

double f(double x) {
        double r3415840 = x;
        double r3415841 = -256116492245931.84;
        bool r3415842 = r3415840 <= r3415841;
        double r3415843 = 1.0;
        double r3415844 = r3415843 / r3415840;
        double r3415845 = 1.0;
        double r3415846 = r3415840 * r3415840;
        double r3415847 = r3415846 * r3415840;
        double r3415848 = r3415845 / r3415847;
        double r3415849 = r3415844 - r3415848;
        double r3415850 = 5.0;
        double r3415851 = pow(r3415840, r3415850);
        double r3415852 = r3415845 / r3415851;
        double r3415853 = r3415849 + r3415852;
        double r3415854 = 1075528.262632116;
        bool r3415855 = r3415840 <= r3415854;
        double r3415856 = r3415846 * r3415846;
        double r3415857 = r3415846 * r3415856;
        double r3415858 = r3415845 * r3415845;
        double r3415859 = r3415845 * r3415858;
        double r3415860 = r3415857 + r3415859;
        double r3415861 = r3415840 / r3415860;
        double r3415862 = r3415845 * r3415846;
        double r3415863 = r3415858 - r3415862;
        double r3415864 = r3415856 + r3415863;
        double r3415865 = r3415861 * r3415864;
        double r3415866 = r3415855 ? r3415865 : r3415853;
        double r3415867 = r3415842 ? r3415853 : r3415866;
        return r3415867;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -256116492245931.84 or 1075528.262632116 < x

    1. Initial program 31.3

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

      \[\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/54.9

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

      \[\leadsto \color{blue}{\frac{x}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + 1 \cdot \left(1 \cdot 1\right)}} \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)\]
    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}}}\]
    7. Simplified0.0

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

    if -256116492245931.84 < x < 1075528.262632116

    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}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + 1 \cdot \left(1 \cdot 1\right)}} \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 -256116492245931.84375:\\ \;\;\;\;\left(\frac{1}{x} - \frac{1}{\left(x \cdot x\right) \cdot x}\right) + \frac{1}{{x}^{5}}\\ \mathbf{elif}\;x \le 1075528.26263211597688496112823486328125:\\ \;\;\;\;\frac{x}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + 1 \cdot \left(1 \cdot 1\right)} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - 1 \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} - \frac{1}{\left(x \cdot x\right) \cdot x}\right) + \frac{1}{{x}^{5}}\\ \end{array}\]

Reproduce

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

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

  (/ x (+ (* x x) 1.0)))