Average Error: 14.7 → 0.0
Time: 3.4s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3787.2690012206258 \lor \neg \left(x \le 25.5020765692938873\right):\\ \;\;\;\;\left(1 \cdot \left(\frac{1}{{x}^{9}} + \frac{1}{{x}^{5}}\right) + \frac{1}{x}\right) + \left(-\frac{1 \cdot x}{{x}^{4} - 1 \cdot 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \left(x \cdot x - 1\right)\\ \end{array}\]
\frac{x}{x \cdot x + 1}
\begin{array}{l}
\mathbf{if}\;x \le -3787.2690012206258 \lor \neg \left(x \le 25.5020765692938873\right):\\
\;\;\;\;\left(1 \cdot \left(\frac{1}{{x}^{9}} + \frac{1}{{x}^{5}}\right) + \frac{1}{x}\right) + \left(-\frac{1 \cdot x}{{x}^{4} - 1 \cdot 1}\right)\\

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

\end{array}
double f(double x) {
        double r70684 = x;
        double r70685 = r70684 * r70684;
        double r70686 = 1.0;
        double r70687 = r70685 + r70686;
        double r70688 = r70684 / r70687;
        return r70688;
}

double f(double x) {
        double r70689 = x;
        double r70690 = -3787.269001220626;
        bool r70691 = r70689 <= r70690;
        double r70692 = 25.502076569293887;
        bool r70693 = r70689 <= r70692;
        double r70694 = !r70693;
        bool r70695 = r70691 || r70694;
        double r70696 = 1.0;
        double r70697 = 1.0;
        double r70698 = 9.0;
        double r70699 = pow(r70689, r70698);
        double r70700 = r70697 / r70699;
        double r70701 = 5.0;
        double r70702 = pow(r70689, r70701);
        double r70703 = r70697 / r70702;
        double r70704 = r70700 + r70703;
        double r70705 = r70696 * r70704;
        double r70706 = r70697 / r70689;
        double r70707 = r70705 + r70706;
        double r70708 = r70696 * r70689;
        double r70709 = 4.0;
        double r70710 = pow(r70689, r70709);
        double r70711 = r70696 * r70696;
        double r70712 = r70710 - r70711;
        double r70713 = r70708 / r70712;
        double r70714 = -r70713;
        double r70715 = r70707 + r70714;
        double r70716 = -r70711;
        double r70717 = r70716 + r70710;
        double r70718 = r70689 / r70717;
        double r70719 = r70689 * r70689;
        double r70720 = r70719 - r70696;
        double r70721 = r70718 * r70720;
        double r70722 = r70695 ? r70715 : r70721;
        return r70722;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.7
Target0.1
Herbie0.0
\[\frac{1}{x + \frac{1}{x}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -3787.269001220626 or 25.502076569293887 < x

    1. Initial program 29.7

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

      \[\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/47.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. Simplified47.1

      \[\leadsto \color{blue}{\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}}} \cdot \left(x \cdot x - 1\right)\]
    6. Using strategy rm
    7. Applied sub-neg47.1

      \[\leadsto \frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \color{blue}{\left(x \cdot x + \left(-1\right)\right)}\]
    8. Applied distribute-lft-in47.1

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

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

      \[\leadsto \frac{{x}^{3}}{{x}^{4} - 1 \cdot 1} + \color{blue}{\left(-\frac{1 \cdot x}{{x}^{4} - 1 \cdot 1}\right)}\]
    11. Taylor expanded around inf 0.0

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

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

    if -3787.269001220626 < x < 25.502076569293887

    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.0

      \[\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.0

      \[\leadsto \color{blue}{\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}}} \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 -3787.2690012206258 \lor \neg \left(x \le 25.5020765692938873\right):\\ \;\;\;\;\left(1 \cdot \left(\frac{1}{{x}^{9}} + \frac{1}{{x}^{5}}\right) + \frac{1}{x}\right) + \left(-\frac{1 \cdot x}{{x}^{4} - 1 \cdot 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(-1 \cdot 1\right) + {x}^{4}} \cdot \left(x \cdot x - 1\right)\\ \end{array}\]

Reproduce

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

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

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