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

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

\end{array}
double f(double x) {
        double r45759 = x;
        double r45760 = r45759 * r45759;
        double r45761 = 1.0;
        double r45762 = r45760 + r45761;
        double r45763 = r45759 / r45762;
        return r45763;
}

double f(double x) {
        double r45764 = x;
        double r45765 = -7.923926095867654e+69;
        bool r45766 = r45764 <= r45765;
        double r45767 = 409.757310106414;
        bool r45768 = r45764 <= r45767;
        double r45769 = !r45768;
        bool r45770 = r45766 || r45769;
        double r45771 = 1.0;
        double r45772 = r45771 / r45764;
        double r45773 = 1.0;
        double r45774 = 5.0;
        double r45775 = pow(r45764, r45774);
        double r45776 = r45773 / r45775;
        double r45777 = r45772 + r45776;
        double r45778 = 3.0;
        double r45779 = pow(r45764, r45778);
        double r45780 = r45773 / r45779;
        double r45781 = r45777 - r45780;
        double r45782 = r45764 * r45779;
        double r45783 = r45773 * r45773;
        double r45784 = r45782 - r45783;
        double r45785 = r45764 / r45784;
        double r45786 = r45764 * r45764;
        double r45787 = r45786 - r45773;
        double r45788 = r45785 * r45787;
        double r45789 = r45770 ? r45781 : r45788;
        return r45789;
}

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 < -7.923926095867654e+69 or 409.757310106414 < x

    1. Initial program 34.3

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

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/54.3

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

      \[\leadsto \color{blue}{\frac{x}{x \cdot {x}^{3} - 1 \cdot 1}} \cdot \left(x \cdot x - 1\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{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}}\]

    if -7.923926095867654e+69 < x < 409.757310106414

    1. Initial program 0.0

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

      \[\leadsto \frac{x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    4. Applied associate-/r/0.1

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

      \[\leadsto \color{blue}{\frac{x}{x \cdot {x}^{3} - 1 \cdot 1}} \cdot \left(x \cdot x - 1\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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

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

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