Average Error: 15.2 → 0.0
Time: 2.1s
Precision: 64
\[\frac{x}{x \cdot x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -76798468.31292221 \lor \neg \left(x \le 8077604.2444988824\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 -76798468.31292221 \lor \neg \left(x \le 8077604.2444988824\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 r66073 = x;
        double r66074 = r66073 * r66073;
        double r66075 = 1.0;
        double r66076 = r66074 + r66075;
        double r66077 = r66073 / r66076;
        return r66077;
}

double f(double x) {
        double r66078 = x;
        double r66079 = -76798468.31292221;
        bool r66080 = r66078 <= r66079;
        double r66081 = 8077604.244498882;
        bool r66082 = r66078 <= r66081;
        double r66083 = !r66082;
        bool r66084 = r66080 || r66083;
        double r66085 = 1.0;
        double r66086 = 1.0;
        double r66087 = 5.0;
        double r66088 = pow(r66078, r66087);
        double r66089 = r66086 / r66088;
        double r66090 = r66085 * r66089;
        double r66091 = r66086 / r66078;
        double r66092 = r66090 + r66091;
        double r66093 = 3.0;
        double r66094 = pow(r66078, r66093);
        double r66095 = r66086 / r66094;
        double r66096 = r66085 * r66095;
        double r66097 = r66092 - r66096;
        double r66098 = r66078 * r66078;
        double r66099 = r66098 + r66085;
        double r66100 = r66078 / r66099;
        double r66101 = r66084 ? r66097 : r66100;
        return r66101;
}

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 < -76798468.31292221 or 8077604.244498882 < x

    1. Initial program 31.3

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied flip-+49.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/49.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. Simplified49.1

      \[\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 -76798468.31292221 < x < 8077604.244498882

    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 -76798468.31292221 \lor \neg \left(x \le 8077604.2444988824\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 2020083 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

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

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