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

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

\end{array}
double f(double x) {
        double r64784 = x;
        double r64785 = r64784 * r64784;
        double r64786 = 1.0;
        double r64787 = r64785 + r64786;
        double r64788 = r64784 / r64787;
        return r64788;
}

double f(double x) {
        double r64789 = x;
        double r64790 = -6272088098.259001;
        bool r64791 = r64789 <= r64790;
        double r64792 = 460.75227704809595;
        bool r64793 = r64789 <= r64792;
        double r64794 = !r64793;
        bool r64795 = r64791 || r64794;
        double r64796 = 1.0;
        double r64797 = 1.0;
        double r64798 = 5.0;
        double r64799 = pow(r64789, r64798);
        double r64800 = r64797 / r64799;
        double r64801 = r64796 * r64800;
        double r64802 = r64797 / r64789;
        double r64803 = r64801 + r64802;
        double r64804 = 3.0;
        double r64805 = pow(r64789, r64804);
        double r64806 = r64797 / r64805;
        double r64807 = r64796 * r64806;
        double r64808 = r64803 - r64807;
        double r64809 = r64789 * r64789;
        double r64810 = r64809 + r64796;
        double r64811 = r64789 / r64810;
        double r64812 = r64795 ? r64808 : r64811;
        return r64812;
}

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 < -6272088098.259001 or 460.75227704809595 < x

    1. Initial program 30.6

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

      \[\leadsto \frac{x}{\color{blue}{\left(\sqrt[3]{x \cdot x + 1} \cdot \sqrt[3]{x \cdot x + 1}\right) \cdot \sqrt[3]{x \cdot x + 1}}}\]
    4. Applied *-un-lft-identity31.1

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(\sqrt[3]{x \cdot x + 1} \cdot \sqrt[3]{x \cdot x + 1}\right) \cdot \sqrt[3]{x \cdot x + 1}}\]
    5. Applied times-frac31.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{x \cdot x + 1} \cdot \sqrt[3]{x \cdot x + 1}} \cdot \frac{x}{\sqrt[3]{x \cdot x + 1}}}\]
    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}}}\]

    if -6272088098.259001 < x < 460.75227704809595

    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 -6272088098.2590008 \lor \neg \left(x \le 460.75227704809595\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x + 1}\\ \end{array}\]

Reproduce

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

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

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