Average Error: 15.4 → 0.0
Time: 10.3s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.706609531695333 \cdot 10^{+23}:\\ \;\;\;\;\frac{1}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)} + \left(\frac{1}{x} - \frac{1}{x \cdot \left(x \cdot x\right)}\right)\\ \mathbf{elif}\;x \le 419.6688046932846:\\ \;\;\;\;\frac{x}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + 1} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 - x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)} + \left(\frac{1}{x} - \frac{1}{x \cdot \left(x \cdot x\right)}\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -7.706609531695333 \cdot 10^{+23}:\\
\;\;\;\;\frac{1}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)} + \left(\frac{1}{x} - \frac{1}{x \cdot \left(x \cdot x\right)}\right)\\

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

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

\end{array}
double f(double x) {
        double r2086800 = x;
        double r2086801 = r2086800 * r2086800;
        double r2086802 = 1.0;
        double r2086803 = r2086801 + r2086802;
        double r2086804 = r2086800 / r2086803;
        return r2086804;
}

double f(double x) {
        double r2086805 = x;
        double r2086806 = -7.706609531695333e+23;
        bool r2086807 = r2086805 <= r2086806;
        double r2086808 = 1.0;
        double r2086809 = r2086805 * r2086805;
        double r2086810 = r2086805 * r2086809;
        double r2086811 = r2086810 * r2086809;
        double r2086812 = r2086808 / r2086811;
        double r2086813 = r2086808 / r2086805;
        double r2086814 = r2086808 / r2086810;
        double r2086815 = r2086813 - r2086814;
        double r2086816 = r2086812 + r2086815;
        double r2086817 = 419.6688046932846;
        bool r2086818 = r2086805 <= r2086817;
        double r2086819 = r2086810 * r2086810;
        double r2086820 = r2086819 + r2086808;
        double r2086821 = r2086805 / r2086820;
        double r2086822 = r2086809 * r2086809;
        double r2086823 = r2086808 - r2086809;
        double r2086824 = r2086822 + r2086823;
        double r2086825 = r2086821 * r2086824;
        double r2086826 = r2086818 ? r2086825 : r2086816;
        double r2086827 = r2086807 ? r2086816 : r2086826;
        return r2086827;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -7.706609531695333e+23 or 419.6688046932846 < x

    1. Initial program 31.9

      \[\frac{x}{x \cdot x + 1}\]
    2. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}}\]
    3. Simplified0.0

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

    if -7.706609531695333e+23 < x < 419.6688046932846

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

Reproduce

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

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

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