Average Error: 15.3 → 0.0
Time: 18.1s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.34406943704910861 \cdot 10^{154} \lor \neg \left(x \le 742.619391624043487\right):\\ \;\;\;\;\left(\frac{1}{x} - \frac{1}{{x}^{3}}\right) + \frac{1}{{x}^{5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -1.34406943704910861 \cdot 10^{154} \lor \neg \left(x \le 742.619391624043487\right):\\
\;\;\;\;\left(\frac{1}{x} - \frac{1}{{x}^{3}}\right) + \frac{1}{{x}^{5}}\\

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

\end{array}
double f(double x) {
        double r41515 = x;
        double r41516 = r41515 * r41515;
        double r41517 = 1.0;
        double r41518 = r41516 + r41517;
        double r41519 = r41515 / r41518;
        return r41519;
}

double f(double x) {
        double r41520 = x;
        double r41521 = -1.3440694370491086e+154;
        bool r41522 = r41520 <= r41521;
        double r41523 = 742.6193916240435;
        bool r41524 = r41520 <= r41523;
        double r41525 = !r41524;
        bool r41526 = r41522 || r41525;
        double r41527 = 1.0;
        double r41528 = r41527 / r41520;
        double r41529 = 1.0;
        double r41530 = 3.0;
        double r41531 = pow(r41520, r41530);
        double r41532 = r41529 / r41531;
        double r41533 = r41528 - r41532;
        double r41534 = 5.0;
        double r41535 = pow(r41520, r41534);
        double r41536 = r41529 / r41535;
        double r41537 = r41533 + r41536;
        double r41538 = r41520 * r41520;
        double r41539 = r41538 + r41529;
        double r41540 = sqrt(r41539);
        double r41541 = r41520 / r41540;
        double r41542 = r41541 / r41540;
        double r41543 = r41526 ? r41537 : r41542;
        return r41543;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -1.3440694370491086e+154 or 742.6193916240435 < x

    1. Initial program 39.8

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt39.8

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}}}\]
    4. Applied associate-/r*39.7

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
    5. 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}}}\]
    6. Simplified0.0

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

    if -1.3440694370491086e+154 < x < 742.6193916240435

    1. Initial program 0.1

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}}}\]
    4. Applied associate-/r*0.0

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

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

Reproduce

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

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

  (/ x (+ (* x x) 1.0)))