Average Error: 15.1 → 0.0
Time: 1.9s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -96697665796.7887421 \lor \neg \left(x \le 2079.1523356116918\right):\\ \;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\ \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 -96697665796.7887421 \lor \neg \left(x \le 2079.1523356116918\right):\\
\;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\

\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 r84354 = x;
        double r84355 = r84354 * r84354;
        double r84356 = 1.0;
        double r84357 = r84355 + r84356;
        double r84358 = r84354 / r84357;
        return r84358;
}

double f(double x) {
        double r84359 = x;
        double r84360 = -96697665796.78874;
        bool r84361 = r84359 <= r84360;
        double r84362 = 2079.152335611692;
        bool r84363 = r84359 <= r84362;
        double r84364 = !r84363;
        bool r84365 = r84361 || r84364;
        double r84366 = 1.0;
        double r84367 = 1.0;
        double r84368 = 5.0;
        double r84369 = pow(r84359, r84368);
        double r84370 = r84367 / r84369;
        double r84371 = r84366 * r84370;
        double r84372 = r84367 / r84359;
        double r84373 = r84371 + r84372;
        double r84374 = 3.0;
        double r84375 = pow(r84359, r84374);
        double r84376 = r84367 / r84375;
        double r84377 = r84366 * r84376;
        double r84378 = r84373 - r84377;
        double r84379 = r84366 * r84366;
        double r84380 = -r84379;
        double r84381 = 4.0;
        double r84382 = pow(r84359, r84381);
        double r84383 = r84380 + r84382;
        double r84384 = r84359 / r84383;
        double r84385 = r84359 * r84359;
        double r84386 = r84385 - r84366;
        double r84387 = r84384 * r84386;
        double r84388 = r84365 ? r84378 : r84387;
        return r84388;
}

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 < -96697665796.78874 or 2079.152335611692 < x

    1. Initial program 30.2

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

      \[\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/48.6

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

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

    if -96697665796.78874 < x < 2079.152335611692

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

Reproduce

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

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

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