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

\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 r54635 = x;
        double r54636 = r54635 * r54635;
        double r54637 = 1.0;
        double r54638 = r54636 + r54637;
        double r54639 = r54635 / r54638;
        return r54639;
}

double f(double x) {
        double r54640 = x;
        double r54641 = -2.532497333585514e+16;
        bool r54642 = r54640 <= r54641;
        double r54643 = 414.462941397456;
        bool r54644 = r54640 <= r54643;
        double r54645 = !r54644;
        bool r54646 = r54642 || r54645;
        double r54647 = 1.0;
        double r54648 = 1.0;
        double r54649 = 5.0;
        double r54650 = pow(r54640, r54649);
        double r54651 = r54648 / r54650;
        double r54652 = 3.0;
        double r54653 = pow(r54640, r54652);
        double r54654 = r54648 / r54653;
        double r54655 = r54651 - r54654;
        double r54656 = r54647 * r54655;
        double r54657 = r54648 / r54640;
        double r54658 = r54656 + r54657;
        double r54659 = r54640 * r54640;
        double r54660 = pow(r54659, r54652);
        double r54661 = pow(r54647, r54652);
        double r54662 = r54660 + r54661;
        double r54663 = r54640 / r54662;
        double r54664 = r54659 * r54659;
        double r54665 = r54647 * r54647;
        double r54666 = r54659 * r54647;
        double r54667 = r54665 - r54666;
        double r54668 = r54664 + r54667;
        double r54669 = r54663 * r54668;
        double r54670 = r54646 ? r54658 : r54669;
        return r54670;
}

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 < -2.532497333585514e+16 or 414.462941397456 < x

    1. Initial program 31.1

      \[\frac{x}{x \cdot x + 1}\]
    2. 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}}}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{1 \cdot \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right) + \frac{1}{x}}\]

    if -2.532497333585514e+16 < x < 414.462941397456

    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 -25324973335855140 \lor \neg \left(x \le 414.4629413974560065980767831206321716309\right):\\ \;\;\;\;1 \cdot \left(\frac{1}{{x}^{5}} - \frac{1}{{x}^{3}}\right) + \frac{1}{x}\\ \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 2019354 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

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

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