Average Error: 15.1 → 0.0
Time: 12.2s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -256116492245931.84375:\\ \;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\ \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}:\\ \;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -256116492245931.84375:\\
\;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\

\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}:\\
\;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\

\end{array}
double f(double x) {
        double r3267037 = x;
        double r3267038 = r3267037 * r3267037;
        double r3267039 = 1.0;
        double r3267040 = r3267038 + r3267039;
        double r3267041 = r3267037 / r3267040;
        return r3267041;
}

double f(double x) {
        double r3267042 = x;
        double r3267043 = -256116492245931.84;
        bool r3267044 = r3267042 <= r3267043;
        double r3267045 = 1.0;
        double r3267046 = 5.0;
        double r3267047 = pow(r3267042, r3267046);
        double r3267048 = r3267045 / r3267047;
        double r3267049 = 1.0;
        double r3267050 = r3267049 / r3267042;
        double r3267051 = r3267042 * r3267042;
        double r3267052 = r3267045 / r3267051;
        double r3267053 = r3267052 / r3267042;
        double r3267054 = r3267050 - r3267053;
        double r3267055 = r3267048 + r3267054;
        double r3267056 = 1075528.262632116;
        bool r3267057 = r3267042 <= r3267056;
        double r3267058 = r3267051 * r3267051;
        double r3267059 = r3267051 * r3267058;
        double r3267060 = r3267045 * r3267045;
        double r3267061 = r3267045 * r3267060;
        double r3267062 = r3267059 + r3267061;
        double r3267063 = r3267042 / r3267062;
        double r3267064 = r3267045 * r3267051;
        double r3267065 = r3267060 - r3267064;
        double r3267066 = r3267058 + r3267065;
        double r3267067 = r3267063 * r3267066;
        double r3267068 = r3267057 ? r3267067 : r3267055;
        double r3267069 = r3267044 ? r3267055 : r3267068;
        return r3267069;
}

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

    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(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 - \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:\\ \;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\ \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}:\\ \;\;\;\;\frac{1}{{x}^{5}} + \left(\frac{1}{x} - \frac{\frac{1}{x \cdot x}}{x}\right)\\ \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)))