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

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

\end{array}
double f(double x) {
        double r52284 = x;
        double r52285 = r52284 * r52284;
        double r52286 = 1.0;
        double r52287 = r52285 + r52286;
        double r52288 = r52284 / r52287;
        return r52288;
}

double f(double x) {
        double r52289 = x;
        double r52290 = -1.033538641236291e+25;
        bool r52291 = r52289 <= r52290;
        double r52292 = 23741.194574337824;
        bool r52293 = r52289 <= r52292;
        double r52294 = !r52293;
        bool r52295 = r52291 || r52294;
        double r52296 = 1.0;
        double r52297 = 1.0;
        double r52298 = 5.0;
        double r52299 = pow(r52289, r52298);
        double r52300 = r52297 / r52299;
        double r52301 = r52296 * r52300;
        double r52302 = r52297 / r52289;
        double r52303 = r52301 + r52302;
        double r52304 = 3.0;
        double r52305 = pow(r52289, r52304);
        double r52306 = r52297 / r52305;
        double r52307 = r52296 * r52306;
        double r52308 = r52303 - r52307;
        double r52309 = r52289 * r52289;
        double r52310 = r52309 + r52296;
        double r52311 = r52297 / r52310;
        double r52312 = r52289 * r52311;
        double r52313 = r52295 ? r52308 : r52312;
        return r52313;
}

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 < -1.033538641236291e+25 or 23741.194574337824 < x

    1. Initial program 31.3

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied div-inv31.4

      \[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
    4. Using strategy rm
    5. Applied flip-+49.4

      \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}{x \cdot x - 1}}}\]
    6. Applied associate-/r/49.4

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1} \cdot \left(x \cdot x - 1\right)\right)}\]
    7. Applied associate-*r*49.4

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 1 \cdot 1}\right) \cdot \left(x \cdot x - 1\right)}\]
    8. Simplified49.4

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

    1. Initial program 0.0

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied div-inv0.0

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

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

Reproduce

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

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

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