Average Error: 15.1 → 0.0
Time: 1.2s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.24131751724691352 \cdot 10^{31} \lor \neg \left(x \le 447.85106598207193\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 -1.24131751724691352 \cdot 10^{31} \lor \neg \left(x \le 447.85106598207193\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 r73687 = x;
        double r73688 = r73687 * r73687;
        double r73689 = 1.0;
        double r73690 = r73688 + r73689;
        double r73691 = r73687 / r73690;
        return r73691;
}

double f(double x) {
        double r73692 = x;
        double r73693 = -1.2413175172469135e+31;
        bool r73694 = r73692 <= r73693;
        double r73695 = 447.85106598207193;
        bool r73696 = r73692 <= r73695;
        double r73697 = !r73696;
        bool r73698 = r73694 || r73697;
        double r73699 = 1.0;
        double r73700 = 1.0;
        double r73701 = 5.0;
        double r73702 = pow(r73692, r73701);
        double r73703 = r73700 / r73702;
        double r73704 = 3.0;
        double r73705 = pow(r73692, r73704);
        double r73706 = r73700 / r73705;
        double r73707 = r73703 - r73706;
        double r73708 = r73699 * r73707;
        double r73709 = r73700 / r73692;
        double r73710 = r73708 + r73709;
        double r73711 = r73692 * r73692;
        double r73712 = r73711 + r73699;
        double r73713 = r73692 / r73712;
        double r73714 = r73698 ? r73710 : r73713;
        return r73714;
}

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 < -1.2413175172469135e+31 or 447.85106598207193 < x

    1. Initial program 32.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 -1.2413175172469135e+31 < x < 447.85106598207193

    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 -1.24131751724691352 \cdot 10^{31} \lor \neg \left(x \le 447.85106598207193\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 2020062 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

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

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