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

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

\end{array}
double f(double x) {
        double r81912 = x;
        double r81913 = r81912 * r81912;
        double r81914 = 1.0;
        double r81915 = r81913 + r81914;
        double r81916 = r81912 / r81915;
        return r81916;
}

double f(double x) {
        double r81917 = x;
        double r81918 = -4377789621347.088;
        bool r81919 = r81917 <= r81918;
        double r81920 = 434.3260566585274;
        bool r81921 = r81917 <= r81920;
        double r81922 = !r81921;
        bool r81923 = r81919 || r81922;
        double r81924 = 1.0;
        double r81925 = 5.0;
        double r81926 = pow(r81917, r81925);
        double r81927 = r81924 / r81926;
        double r81928 = 1.0;
        double r81929 = r81928 / r81917;
        double r81930 = 3.0;
        double r81931 = pow(r81917, r81930);
        double r81932 = r81924 / r81931;
        double r81933 = r81929 - r81932;
        double r81934 = r81927 + r81933;
        double r81935 = 4.0;
        double r81936 = pow(r81917, r81935);
        double r81937 = r81924 * r81924;
        double r81938 = r81936 - r81937;
        double r81939 = r81917 / r81938;
        double r81940 = r81917 * r81917;
        double r81941 = r81940 - r81924;
        double r81942 = r81939 * r81941;
        double r81943 = r81923 ? r81934 : r81942;
        return r81943;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -4377789621347.088 or 434.3260566585274 < x

    1. Initial program 30.7

      \[\frac{x}{x \cdot x + 1}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt30.7

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}}}\]
    4. Applied associate-/r*30.5

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x \cdot x + 1}}}{\sqrt{x \cdot x + 1}}}\]
    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}}}\]
    6. Simplified0.0

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

    if -4377789621347.088 < x < 434.3260566585274

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

Reproduce

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

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

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