Average Error: 15.2 → 0.0
Time: 1.4s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -748130049.40968013 \lor \neg \left(x \le 439.159106874169822\right):\\ \;\;\;\;1 \cdot \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right) + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x + 1}\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -748130049.40968013 \lor \neg \left(x \le 439.159106874169822\right):\\
\;\;\;\;1 \cdot \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right) + \frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x \cdot x + 1}\\

\end{array}
double f(double x) {
        double r50780 = x;
        double r50781 = r50780 * r50780;
        double r50782 = 1.0;
        double r50783 = r50781 + r50782;
        double r50784 = r50780 / r50783;
        return r50784;
}

double f(double x) {
        double r50785 = x;
        double r50786 = -748130049.4096801;
        bool r50787 = r50785 <= r50786;
        double r50788 = 439.1591068741698;
        bool r50789 = r50785 <= r50788;
        double r50790 = !r50789;
        bool r50791 = r50787 || r50790;
        double r50792 = 1.0;
        double r50793 = 1.0;
        double r50794 = 5.0;
        double r50795 = pow(r50785, r50794);
        double r50796 = r50793 / r50795;
        double r50797 = 3.0;
        double r50798 = pow(r50785, r50797);
        double r50799 = r50793 / r50798;
        double r50800 = r50796 - r50799;
        double r50801 = r50792 * r50800;
        double r50802 = r50793 / r50785;
        double r50803 = r50801 + r50802;
        double r50804 = r50785 * r50785;
        double r50805 = r50804 + r50792;
        double r50806 = r50785 / r50805;
        double r50807 = r50791 ? r50803 : r50806;
        return r50807;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -748130049.4096801 or 439.1591068741698 < x

    1. Initial program 31.0

      \[\frac{x}{x \cdot x + 1}\]
    2. 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}}}\]
    3. Simplified0.0

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

    if -748130049.4096801 < x < 439.1591068741698

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -748130049.40968013 \lor \neg \left(x \le 439.159106874169822\right):\\ \;\;\;\;1 \cdot \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right) + \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x + 1}\\ \end{array}\]

Reproduce

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

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

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