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

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

\end{array}
double f(double x) {
        double r50237 = x;
        double r50238 = r50237 * r50237;
        double r50239 = 1.0;
        double r50240 = r50238 + r50239;
        double r50241 = r50237 / r50240;
        return r50241;
}

double f(double x) {
        double r50242 = x;
        double r50243 = -172600413441418.5;
        bool r50244 = r50242 <= r50243;
        double r50245 = 730.8537816627762;
        bool r50246 = r50242 <= r50245;
        double r50247 = !r50246;
        bool r50248 = r50244 || r50247;
        double r50249 = 1.0;
        double r50250 = 1.0;
        double r50251 = 5.0;
        double r50252 = pow(r50242, r50251);
        double r50253 = r50250 / r50252;
        double r50254 = r50249 * r50253;
        double r50255 = r50250 / r50242;
        double r50256 = r50254 + r50255;
        double r50257 = 3.0;
        double r50258 = pow(r50242, r50257);
        double r50259 = r50250 / r50258;
        double r50260 = r50249 * r50259;
        double r50261 = r50256 - r50260;
        double r50262 = r50242 * r50242;
        double r50263 = pow(r50262, r50257);
        double r50264 = pow(r50249, r50257);
        double r50265 = r50263 + r50264;
        double r50266 = r50242 / r50265;
        double r50267 = r50262 * r50262;
        double r50268 = r50249 * r50249;
        double r50269 = r50262 * r50249;
        double r50270 = r50268 - r50269;
        double r50271 = r50267 + r50270;
        double r50272 = r50266 * r50271;
        double r50273 = r50248 ? r50261 : r50272;
        return r50273;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -172600413441418.5 or 730.8537816627762 < x

    1. Initial program 30.5

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

      \[\leadsto \frac{x}{\color{blue}{\frac{{\left(x \cdot x\right)}^{3} + {1}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)}}}\]
    4. Applied associate-/r/54.5

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

    if -172600413441418.5 < x < 730.8537816627762

    1. Initial program 0.0

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

      \[\leadsto \frac{x}{\color{blue}{\frac{{\left(x \cdot x\right)}^{3} + {1}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)}}}\]
    4. Applied associate-/r/0.0

      \[\leadsto \color{blue}{\frac{x}{{\left(x \cdot x\right)}^{3} + {1}^{3}} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(1 \cdot 1 - \left(x \cdot x\right) \cdot 1\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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

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

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